Learn R Programming

smooth (version 3.1.5)

msdecompose: Multiple seasonal classical decomposition

Description

Function decomposes multiple seasonal time series into components using the principles of classical decomposition.

Usage

msdecompose(y, lags = c(12), type = c("additive", "multiplicative"))

Arguments

y

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

lags

Vector of lags, corresponding to the frequencies in the data.

type

The type of decomposition. If "multiplicative" is selected, then the logarithm of data is taken prior to the decomposition.

Value

The object of the class "msdecompose" is return, containing:

  • y - the original time series.

  • initial - the estimates of the initial level and trend.

  • trend - the long term trend in the data.

  • seasonal - the list of seasonal parameters.

  • lags - the provided lags.

  • type - the selected type of the decomposition.

  • yName - the name of the provided data.

Details

The function applies centred moving averages based on filter function and order specified in lags variable in order to smooth the original series and obtain level, trend and seasonal components of the series.

See Also

filter

Examples

Run this code
# NOT RUN {
# Decomposition of multiple frequency data
# }
# NOT RUN {
ourModel <- msdecompose(forecast::taylor, lags=c(48,336), type="m")
# }
# NOT RUN {
ourModel <- msdecompose(AirPassengers, lags=c(12), type="m")

plot(ourModel)
plot(forecast(ourModel, model="AAN", h=12))

# }

Run the code above in your browser using DataLab