cma: Centered Moving Average

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/cma.R

Description

Function constructs centered moving average based on state space SMA

Usage

1
cma(y, order = NULL, silent = TRUE, ...)

Arguments

y

Vector or ts object, containing data needed to be smoothed.

order

Order of centered moving average. If NULL, then the function will try to select order of SMA based on information criteria. See sma for details.

silent

If TRUE, then plot is not produced. Otherwise, there is a plot...

...

Nothing. Needed only for the transition to the new name of variables.

Details

If the order is odd, then the function constructs SMA(order) and shifts it back in time. Otherwise an AR(order+1) model is constructed with the preset parameters:

phi_i = 0.5,1,1,...,0.5 / order

This then corresponds to the centered MA with 0.5 weight for the first observation and 0.5 weight for an additional one. e.g. if this is monthly data and we use order=12, then half of the first January and half of the new one is taken.

This is not a forecasting tool. This is supposed to smooth the time series in order to find trend. So don't expect any forecasts from this function!

Value

Object of class "smooth" is returned. It contains the list of the following values:

Author(s)

Ivan Svetunkov, ivan@svetunkov.ru

References

See Also

es, ssarima

Examples

1
2
3
4
5
6
7
# CMA of specific order
ourModel <- cma(rnorm(118,100,3),order=12)

# CMA of arbitrary order
ourModel <- cma(rnorm(118,100,3))

summary(ourModel)

config-i1/smooth documentation built on June 16, 2021, 2:13 p.m.