SMEDIAN: Seasonal median model

View source: R/methods-fable.R

SMEDIANR Documentation

Seasonal median model

Description

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.

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.

Value

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

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

tscv documentation built on May 13, 2026, 9:07 a.m.