Last data update: 2014.03.03

R: Center Moving Average
CMAR Documentation

Center Moving Average

Description

Calculate moving average by mothod of centered moving average.

Usage

CMA(x, n = 5)

Arguments

x

Observation series.

n

Number of periods to average over.

Value

Observation series after centered moving.

Note

Before, name of this function is TTT.

Author(s)

Doan Hai Nghi <Hainghi1426262609121094@gmail.com>

See Also

SES

Examples

 
CMA(lh,n=5)
CMA(lh,n=8)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(AnalyzeTS)
Loading required package: MASS
Loading required package: TSA
Loading required package: leaps
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-12. For overview type 'help("mgcv-package")'.
Loading required package: tseries

Attaching package: 'TSA'

The following objects are masked from 'package:stats':

    acf, arima

The following object is masked from 'package:utils':

    tar

Loading required package: TTR
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/AnalyzeTS/CMA.Rd_%03d_medium.png", width=480, height=480)
> ### Name: CMA
> ### Title: Center Moving Average
> ### Aliases: CMA
> ### Keywords: CMA
> 
> ### ** Examples
>  
> CMA(lh,n=5)
 [1]   NA   NA 2.30 2.12 2.10 2.08 2.14 2.12 2.20 2.08 2.06 1.92 2.16 2.42 2.62
[16] 2.62 2.70 2.44 2.18 2.00 2.10 2.26 2.34 2.36 2.40 2.44 2.42 2.50 2.64 2.70
[31] 2.64 2.54 2.36 2.16 2.00 1.76 1.70 2.00 2.36 2.76 3.10 3.20 2.96 2.94 2.84
[46] 2.80   NA   NA
> CMA(lh,n=8)
 [1]      NA      NA      NA 2.20625 2.18750 2.13125 2.06875 2.04375 2.06875
[10] 2.14375 2.25625 2.32500 2.35000 2.38125 2.41250 2.40625 2.38750 2.35625
[19] 2.31250 2.27500 2.23750 2.21250 2.26250 2.38750 2.50625 2.56250 2.51875
[28] 2.49375 2.53750 2.55000 2.46250 2.30000 2.13125 2.01250 2.03750 2.15625
[37] 2.28125 2.43125 2.56875 2.66250 2.82500 3.00625 3.03750      NA      NA
[46]      NA      NA      NA
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>