data.frc: Forecast multiple intermittent demand series

View source: R/data.frc.R

data.frcR Documentation

Forecast multiple intermittent demand series

Description

Forecast all columns of a data frame or matrix of intermittent demand series with a single call.

Usage

data.frc(
  data.in,
  method = c("crost", "crost.ma", "tsb", "sexsm", "imapa", "auto"),
  ...
)

Arguments

data.in

Data frame with time series, one per column. This can also be a matrix or array with each column being a different time series.

method

Forecasting method: "crost", "crost.ma", "tsb", "sexsm", "imapa", or "auto". The latter selects between Croston's method, SBA, and SES for each series, using the PKa classification of idclass.

...

Additional inputs passed to the forecasting functions, for example h, cost, probs, or outplot. See the documentation of the individual functions for the options. With method="auto", only the inputs accepted by both crost and sexsm are used, except nop, which is used only by crost.

Details

With method="auto", series that cannot be classified, because they have fewer than two non-zero values, are forecasted with SES.

Value

A list containing:

frc.out

Data frame containing the forecasts of all time series.

out

List with the output of the forecasting function for each series. To access an element of all outputs use, for example, lapply(out, "[[", "frc.in").

lt.out

Only when probs is provided. Data frame containing the quantiles of the demand over the lead time of all time series. The safety stock and the other lead time results of each series are in its lt element of out.

Author(s)

Nikolaos Kourentzes, nikolaos@kourentzes.com

See Also

crost, tsb, sexsm, crost.ma, imapa, idclass.

Examples

set.seed(1)
dataset <- simID(5, 60, idi=1.5, cv2=0.5)

# SBA for all series
fit <- data.frc(dataset, method="crost", type="sba", h=6)
fit$frc.out

# Smoothing parameters of all series
sapply(fit$out, "[[", "weights")

# Automatic selection between Croston, SBA, and SES
data.frc(dataset, method="auto", h=6)$frc.out

# Quantiles of the demand over a lead time of 3 periods
data.frc(dataset, method="tsb", h=3, probs=c(0.9,0.95))$lt.out


tsintermittent documentation built on Nov. 14, 2026, 5:06 p.m.