Trend and seasonality are simultaneously modelled by considering a polynomial for the trend and a polynomial in the seasonality (via dummy variables and their interactions with time) for the different time units (e.g. months).
lm_decomp(yt, order_poly = 1, order_poly_s = 1, season = NULL)
An S4 object with the following elements is returned.
an object of class "mts"
that consists of the
decomposed time series data.
the object name of the initially provided time series object.
the frequency of the time series.
an object of class "lm"
, i.e. basic regression
output; the time variable t
used in the regression is encoded as
seq_along(yt)
; the dummy variable S2
encodes
the first observation time point (and the yearly corresponding time points) as
-1
and the second observation time point (and the yearly corresponding
time points) as 1
, the dummy variable S3
does the same but has
instead for the third observation time point (and the yearly corresponding
time points) a 1
, and so on.
a time series object of class "ts"
or an object that can be
transformed to that class using as.ts
.
the order of the polynomial considered for the trend; the
default is order_poly = 1
.
the order of the polynomial considered for the
seasonality; the default is order_poly_s = 1
.
the seasonal period in yt
; by default, the seasonal
period is obtained automatically from yt
.
Dominik Schulz (Research Assistant) (Department of Economics, Paderborn
University),
Author and Package Creator
Apply ordinary least squares to estimate trend and seasonality simultaneously
in a given time series. This a global approach in contrast to for example
deseats
, which is a local estimation method.
est <- lm_decomp(log(EXPENDITURES), order_poly = 3, order_poly_s = 2)
est
Run the code above in your browser using DataLab