Learn R Programming

Time Series Cross-Valiation

This is a package to automate the cross-validation of time-series models, particularly those created by the forecast and caret packages.

Install as follows:

devtools::install_github('zachmayer/cv.ts')

You can then cross-validate different time series models as follows:

data("AirPassengers")
x <- AirPassengers
myControl <- tseriesControl(maxHorizon=4)
theta_model <- cv.ts(x, thetaForecast, tsControl=myControl)
arima_model <- cv.ts(x, auto.arimaForecast, tsControl=myControl)
ets_model <- cv.ts(x, etsForecast, tsControl=myControl)

theta_model$results
arima_model$results
ets_model$results

This package has been off my radar screen for a long time, and I need to write lots of documentation and tests. Please add issues to the issue tracker, and I welcome any pull requests. https://github.com/zachmayer/cv.ts/issues

Copy Link

Version

Version

0.0.0.90105

License

MIT + file LICENSE

Maintainer

Zachary A Mayer

Last Published

February 15th, 2017

Functions in cv.ts (0.0.0.90105)

batsForecast

BATS forecast wrapper
createTSfolds

Create folds for a time series model UPDATE TO USE CARET!
cv.ts

Function to cross-validate a time series.
etsForecast

Ets forecast wrapper
caretForecast

Caret forecast wrapper
meanForecast

Mean forecast wrapper
lmForecast

Linear model forecast wrapper
naiveForecast

Naive forecast wrapper
auto.arimaForecast

auto.arima forecast wrapper
arimaForecast

Arima forecast wrapper
stsForecast

Structural time series forecast wrapper
tseriesControl

Default Cross-validation control
tsSummary

Default summary function
tbatsForecast

TBATS forecast wrapper
nnetarForecast

NNetar forecast wrapper
rwForecast

Random walk forecast wrapper
testObject

Test if an object exists
snaiveForecast

Seasonal naive forecast wrapper
thetaForecast

Theta forecast wrapper
stl.Forecast

Stl forecast wrapper