R: k-fold Cross-Validation applied to an autoregressive model

CVar {forecast} | R Documentation

## k-fold Cross-Validation applied to an autoregressive model

### Description

`CVar` computes the errors obtained by applying an autoregressive modelling function to subsets of the time series `y` using k-fold cross-validation as described in Bergmeir, Hyndman and Koo (2015).

### Usage

    CVar(y, k = 10, FUN = nnetar, cvtrace = FALSE, ...)

### Arguments

`y` | Univariate time series
`k` | Number of folds to use for cross-validation.
`FUN` | Function to fit an autoregressive model. Currently, it only works with the `nnetar` function.
`cvtrace` | Provide progress information.
`...` | Other arguments are passed to `FUN`.

### Value

A list containing information about the model and accuracy for each fold, plus other summary information computed across folds.

### Author(s)

Gabriel Caceres and Rob J Hyndman

### References

Bergmeir, C., Hyndman, R.J., Koo, B. (2015) A note on the validity of cross-validation for evaluating time series prediction. Monash working paper 10/15. https://robjhyndman.com/publications/cv-time-series/.

### See Also

CV, tsCV.

### Examples

    modelcv <- CVar(lynx, k=5, lambda=0.15)
    print(modelcv)
    print(modelcv$fold1)

[Package forecast version 8.2 Index]