Skip to contents

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

Usage

SMEDIAN(formula, ...)

Arguments

formula

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

...

Further arguments.

Value

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

Details

SMEDIAN() forecasts each future observation using the historical median of the matching seasonal position. Use the lag() special to define the seasonal period, for example lag("week") for hourly data with weekly seasonality.

Examples

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

train_frame <- elec_price |>
  filter(bidding_zone == "DE") |>
  slice_head(n = 24 * 21) |>
  as_tsibble(index = time)

model_frame <- train_frame |>
  model("SMEDIAN" = SMEDIAN(value ~ lag("week")))

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