lm_decomp {deseats} | R Documentation |
Decomposition of Time Series Using Linear Regression
Description
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).
Usage
lm_decomp(yt, order_poly = 1, order_poly_s = 1, season = NULL)
Arguments
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 |
Details
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.
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.
- regression_output
an object of class
"lm"
, i.e. basic regression output; the time variablet
used in the regression is encoded asseq_along(yt)
; the dummy variableS2
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) as1
, the dummy variableS3
does the same but has instead for the third observation time point (and the yearly corresponding time points) a1
, and so on.
Author(s)
Dominik Schulz (Research Assistant) (Department of Economics, Paderborn University),
Author and Package Creator
Examples
est <- lm_decomp(log(EXPENDITURES), order_poly = 3, order_poly_s = 2)
est