Specify a seasonal median benchmark model for use with
fabletools::model().
Arguments
- formula
A model formula specifying the response and
lag()special, for examplevalue ~ 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.
See also
Other SMEDIAN:
fitted.SMEDIAN(),
forecast.SMEDIAN(),
model_sum.SMEDIAN(),
residuals.SMEDIAN()
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>
