persistence {onlineforecast} | R Documentation |
Generate persistence forecasts
Description
Generate persistence and periodic persistence forecasts
Usage
persistence(y, kseq, perlen = NA)
Arguments
y |
(numeric) The model output to be forecasted. |
kseq |
(integer) The horizons to be forecasted. |
perlen |
(integer) The period length for seasonal persistence. |
Details
Generate a forecast matrix using persistence. The simple persistence is with the current value of y, i.e. the value at time t is used as forecast
A seasonal persistence with a specific period can be generated by setting the argument perlen
to the length of the period in steps. The value used for the forecast is then the latest available, which is matches the seasonality for time t+k, see the examples.
Value
Forecast matrix as a data.frame
(named Yhat
in similar functions)
Examples
# Simple persistence just copies the current value for the forecasts
persistence(1:10, kseq=1:4)
# Seasonal persistence takes the value perlen steps back
persistence(1:10, kseq=1:4, perlen=4)
# If the horizons are longer than perlen, then the perlen*i steps back is taken (i is an integer)
persistence(1:10, kseq=1:12, perlen=4)
[Package onlineforecast version 1.0.2 Index]