MEDIAN: Median model

View source: R/methods-fable.R

MEDIANR Documentation

Median model

Description

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

Usage

MEDIAN(formula, ...)

Arguments

formula

A model formula specifying the response and optional window() special, for example value ~ window().

...

Further arguments.

Details

MEDIAN() forecasts future values using the median of the observed response. The window() special controls whether the median is estimated using all observations, a fixed trailing window, or a rolling window.

Value

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

See Also

Other MEDIAN: fitted.MEDIAN(), forecast.MEDIAN(), model_sum.MEDIAN(), residuals.MEDIAN()

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("MEDIAN" = MEDIAN(value ~ window()))

model_frame

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