Trend and seasonality are modelled in a two-step approach, where first the trend is being estimated using local linear regression and then the seasonality is being estimated using various local linear regressions as well. In both cases a manually selected bandwidth is required.
llin_decomp(
yt,
bwidth_trend = 4,
bwidth_season = 5,
kernel_par = 1,
boundary_method = c("extend", "shorten"),
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.
the same as the input argument bwidth_trend
.
the same as the input argument bwidth_season
.
the same as the input argument boundary_method
.
the same as the input argument kernel_par
.
a time series object of class "ts"
or an object that can be
transformed to that class using as.ts
.
half of the absolute bandwidth (in years); represents the amount of data to use around the estimation time point to consider for trend smoothing.
half of the absolute bandwidth (in years); represents the amount of data (only from the same quarter, month, etc.) to use around the estimation time point for the seasonality estimation.
the smoothness parameter for the second-order kernel function
used in the weighting process; for kernel_par = 0
a uniform kernel
is used, for kernel_par = 1
an epanechnikov kernel, and so on.
a single character value; it indicates, what bandwidth
method to use at boundary points; for "extend"
, the default, the
smoothing window around boundary points will be extended towards the center of
the data; for "shorten"
, the window width will keep decreasing at
boundary points when approaching the very first and the very last observation.
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 local linear regression to estimate trend and seasonality in a given time series \(y_t\). Assume that \(y_t\) follows an additive component model with trend and seasonality components. First, a local linear regression with a first (absolute) bandwidth is conducted to estimate the trend from the series. If the seasonal period is \(s\), then afterwards \(s\) local linear regressions (for each individual seasonal subseries of the detrended series) are conducted with a second (absolute) bandwidth to obtain seasonality estimates.
est <- llin_decomp(log(EXPENDITURES), bwidth_trend = 4, bwidth_season = 28)
est
Run the code above in your browser using DataLab