View source: R/fitting_functions.R
lm_decomp | R Documentation |
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)
yt |
a time series object of class |
order_poly |
the order of the polynomial considered for the trend; the
default is |
order_poly_s |
the order of the polynomial considered for the
seasonality; the default is |
season |
the seasonal period in |
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.
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.
Dominik Schulz (Research Assistant) (Department of Economics, Paderborn
University),
Author and Package Creator
est <- lm_decomp(log(EXPENDITURES), order_poly = 3, order_poly_s = 2)
est
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.