idclass: Time series categorisation for intermittent demand

View source: R/idclass.R

idclassR Documentation

Time series categorisation for intermittent demand

Description

Categorise intermittent demand time series according to their average inter-demand interval and the squared coefficient of variation of their non-zero demand, indicating whether they should be modelled with Croston's method, SBA, or SES.

Usage

idclass(
  data,
  type = c("PKa", "SBC", "KHa", "KH", "PK"),
  a.in = NULL,
  outplot = c("summary", "detail", "none"),
  plot.focus = NULL
)

Arguments

data

Time series dataset, where each column is a series. Alternatively, this can be a single series.

type

Type of categorisation:

  • "SBC": Syntetos-Boylan-Croston;

  • "KH": Kostenko-Hyndman (exact);

  • "KHa": Kostenko-Hyndman (approximate);

  • "PK": Petropoulos-Kourentzes (exact);

  • "PKa": Petropoulos-Kourentzes (approximate).

The exact schemes are computationally expensive, as SBA is optimised for each series, unless a.in is provided.

a.in

Vector of SBA interval smoothing parameters, one for each series. This is used by the exact categorisations "KH" and "PK". If NULL, the parameters are optimised internally using MAR as the cost function.

outplot

Plot of the categorisation:

  • "summary": simplified plot that reports the number of series in each class and the cut-off points;

  • "detail": scatterplot of the average inter-demand interval (p) and the squared coefficient of variation of the non-zero demand (CV^2), with the areas of each class shaded;

  • "none": no plot.

Both plots are also available afterwards with plot, see plot.idclass.

plot.focus

Only relevant to outplot == "detail". A vector of two elements, the maximum p and CV^2 to plot, so that the scatterplot can be focused on the area separating the classes, for example c(1.5,1.5). If NULL, the maximums are defined from the dataset.

Details

The Petropoulos-Kourentzes classification extends the Kostenko-Hyndman one for series without zero demand, p = 1, which are assigned to SES instead of Croston's method or SBA. Such series are rare at the original frequency, but common once a series is temporally aggregated, which is why this classification is used by imapa. Series with fewer than two non-zero values cannot be categorised; a warning is given and they are left out of all classes.

Value

An object of class idclass, which is a list containing:

idx.croston

Index of series that are categorised under Croston.

idx.sba

Index of series that are categorised under SBA.

idx.ses

Index of series that are categorised under SES. Provided only for "PK" and "PKa" types.

cv2

Squared coefficient of variation of non-zero demand.

p

Average inter-demand interval.

summary

Summary of number of series under each category.

fit.info

Information used by the methods of the object. Not intended for direct use.

Author(s)

Nikolaos Kourentzes, nikolaos@kourentzes.com

References

Petropoulos, F., and Kourentzes, N. (2015). Forecast combinations for intermittent demand. Journal of the Operational Research Society, 66(6), 914–924. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1057/jors.2014.62")}

Syntetos, A. A., Boylan, J. E., and Croston, J. D. (2005). On the categorization of demand patterns. Journal of the Operational Research Society, 56(5), 495–503.

Kostenko, A. V., and Hyndman, R. J. (2006). A note on the categorization of demand patterns. Journal of the Operational Research Society, 57(10), 1256–1257.

See Also

plot.idclass, imapa, data.frc.

Examples

# Create some data, where each column is a time series
set.seed(1)
dataset <- simID(100, 60, idi=1.15, cv2=0.3)
idclass(dataset)

# Detailed plot of the SBC classification
cls <- idclass(dataset, type="SBC", outplot="detail")
cls$summary

# Focus the detailed plot
idclass(dataset, type="KHa", outplot="detail", plot.focus=c(1.5,1.5))

# Single series
idclass(ts.data1, outplot="none")$summary


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