Learn R Programming

deseats (version 1.1.0)

ma_decomp: Decomposition of Time Series Using Moving Averages

Description

Trend and seasonality are modelled in a two-step approach, where first the trend is being estimated using moving averages and then trend + seasonality are being estimated using moving averages. The difference is then the estimated seasonality.

Usage

ma_decomp(yt, k_trend = 4, k_season = 5, season = NULL)

Value

An S4 object with the following elements is returned.

decomp

an object of class "mts" that consists of the decomposed time series data.

ts_name

the object name of the initially provided time series object.

frequency

the frequency of the time series.

k_trend

the same as the input argument k_trend.

k_season

the same as the input argument k_season.

Arguments

yt

a time series object of class "ts" or an object that can be transformed to that class using as.ts.

k_trend

the complete absolute bandwidth (in years); represents the data of how many years to use around the estimation time point to consider for trend smoothing.

k_season

the complete absolute bandwidth (in years); represents the data of how many years (only from the same quarter, month, etc.) to use around the estimation time point for trend + seasonality smoothing.

season

the seasonal period in yt; by default, the seasonal period is obtained automatically from yt.

Author

  • Dominik Schulz (Research Assistant) (Department of Economics, Paderborn University),
    Author and Package Creator

Details

Apply moving averages to estimate trend and seasonality in a given time series. This approach results in missings NA at boundary points.

Examples

Run this code
est <- ma_decomp(log(EXPENDITURES), k_trend = 6, k_season = 7)
est

Run the code above in your browser using DataLab