Description Usage Arguments Value Examples
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
1 2 | cvts2(x, FUN, tsControl = cvForecastControl(), progress = TRUE,
packages = NULL, ...)
|
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 |
progress |
if TRUE, show the progress bar. |
packages |
extra R packages required by R. Default is NULL |
... |
extra args, if needed |
list with information about then cross-validation like forecasts and accuracy
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.