HTS.predict.knn: K-NN forecast of a histogram time series

View source: R/H_time_series.R

HTS.predict.knnR Documentation

K-NN forecast of a histogram time series

Description

(Beta version) Forecasts a histogram of a time series with the k-nearest neighbours method, based on the L2 Wasserstein distance: the forecast is the mean of the histograms following the k histograms most similar to the one at position.

Usage

HTS.predict.knn(HTS, position = length(HTS@data), k = 3)

Arguments

HTS

A HTS object.

position

An integer, the position of the last observed histogram (default: the last one).

k

The number of neighbours (default 3).

Value

A distributionH object, the forecast.

References

Arroyo, J., Mate, C. (2009). Forecasting histogram time series with k-nearest neighbours methods. International Journal of Forecasting, 25(1), 192-207. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.ijforecast.2008.07.003")}

Examples

prediction <- HTS.predict.knn(HTS = RetHTS, position = 108, k = 3)

HistDAWass documentation built on Oct. 19, 2026, 1:06 a.m.