Skip to contents

Specify a seasonal mean benchmark model for use with fabletools::model().

Usage

SMEAN(formula, ...)

Arguments

formula

A model formula specifying the response and lag() special, for example value ~ lag("year").

...

Further arguments.

Value

A model definition that can be used inside fabletools::model().

Details

SMEAN() forecasts each future observation using the historical mean of the matching seasonal position. Use the lag() special to define the seasonal period, for example lag("year") for monthly data.

Examples

library(dplyr)
library(tsibble)
library(fabletools)

train_frame <- M4_monthly_data |>
  filter(series == first(series)) |>
  as_tsibble(index = index)

model_frame <- train_frame |>
  model("SMEAN" = SMEAN(value ~ lag("year")))

model_frame
#> # A mable: 1 x 1
#>     SMEAN
#>   <model>
#> 1 <SMEAN>