| stlm | R Documentation |
Forecasts of STL objects are obtained by applying a non-seasonal forecasting
model to the seasonally adjusted data and re-seasonalizing using the last
year of the seasonal component. stlm takes a time series y, applies an STL decomposition, and
models the seasonally adjusted data using the model passed as
modelfunction or specified using method. It returns an object
that includes the original STL decomposition and a time series model fitted
to the seasonally adjusted data. This object can be passed to the
forecast.stlm for forecasting.
stlm(
y,
s.window = 7 + 4 * seq(6),
t.window = NULL,
robust = FALSE,
method = c("ets", "arima"),
modelfunction = NULL,
model = NULL,
etsmodel = "ZZN",
lambda = NULL,
biasadj = FALSE,
xreg = NULL,
allow.multiplicative.trend = FALSE,
x = y,
...
)
y |
a numeric vector or univariate time series of class |
s.window |
Either the character string |
t.window |
A number to control the smoothness of the trend. See
|
robust |
If |
method |
Method to use for forecasting the seasonally adjusted series. |
modelfunction |
An alternative way of specifying the function for
modelling the seasonally adjusted series. If |
model |
Output from a previous call to |
etsmodel |
The ets model specification passed to
|
lambda |
Box-Cox transformation parameter. If |
biasadj |
Use adjusted back-transformed mean for Box-Cox
transformations. If transformed data is used to produce forecasts and fitted
values, a regular back transformation will result in median forecasts. If
biasadj is |
xreg |
Historical regressors to be used in
|
allow.multiplicative.trend |
If |
x |
Deprecated. Included for backwards compatibility. |
... |
Other arguments passed to |
The time series model for the seasonally adjusted data can be specified in
stlm using either method or modelfunction. The
method argument provides a shorthand way of specifying
modelfunction for a few special cases. More generally,
modelfunction can be any function with first argument a ts
object, that returns an object that can be passed to forecast().
For example, modelfunction = ar uses the ar() function
for modelling the seasonally adjusted series.
An object of class stlm.
Rob J Hyndman
stats::stl(), ets(), Arima().
tsmod <- stlm(USAccDeaths, modelfunction = ar)
forecast(tsmod, h = 36) |> autoplot()
decomp <- stl(USAccDeaths, s.window = "periodic")
forecast(decomp) |> autoplot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.