Skip to contents

Decomposes the series by STL (or MSTL, for several periods), forecasts the seasonally adjusted series with model and adds back the seasonal pattern of the last cycle.

Usage

model_decomposed(model, periods = NULL, robust = FALSE)

Arguments

model

The model for the seasonally adjusted series.

periods

Seasonal periods to take out; by default the period of the series.

robust

Down-weight outliers in the decomposition.

Value

A model specification, to use with fit_model(), forecast_model() or backtest().

Examples

forecast_model(model_log(model_decomposed(model_drift())), AirPassengers, h = 3)
#>           Jan      Feb      Mar
#> 1961 446.7876 426.2122 491.8037