cvts2: Function to cross-validate a time series

Description Usage Arguments Value Examples

Description

Main function to perform cross-validation. This function was firstly created by Zach Mayer (https://github.com/zachmayer/cv.ts) thanks, and adapted by LOPES. J. E. It

Usage

1
2
cvts2(x, FUN, tsControl = cvForecastControl(), progress = TRUE,
  packages = NULL, ...)

Arguments

x

time series object of class 'ts'

FUN

forecast wrapper function. These are some ones fc_sts, fc_hw, fc_tbats, fc_auto.arima, fc_ses, fc_mean, fc_holt, fc_bats, fc_ets, fc_lm, fc_theta, fc_rw, sfc_naive, fc_naive, fc_nnetar, fc_hws, fc_hwns and fc_hwes. This function works also in parallel very fast in multiple core computers.

tsControl

Generic control for cross-validation process. See cvForecastControl.

progress

if TRUE, show the progress bar.

packages

extra R packages required by R. Default is NULL

...

extra args, if needed

Value

list with information about then cross-validation like forecasts and accuracy

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Control
tsControl <- cvForecastControl(
minObs = 14,
stepSize = 10,
maxHorizon = 30,
summaryFunc=tsSummary,
cvMethod="MAPE",
OutlierClean=FALSE)
#cl <- makeCluster(4, type='SOCK')
#registerDoParallel(cl)
x <- AirPassengers
fit <- cvts2(x, fc_auto.arima)
#stopCluster(cl)

evandeilton/cvforecast documentation built on May 16, 2019, 9:36 a.m.