karma.cv: Fitted model validation and cross-validation (and related...

Description Usage Arguments Value See Also Examples

Description

Fitted model validation and cross-validation (and related plots).

Usage

1
2
3
karma.cv(karma0, y = c(), test_pct = "auto", test_type = "auto",
  log = F, metric = "MAPE", xreg = NULL, fixed = F, plot = T,
  ensemble = F, cv = "out", stdout = F)

Arguments

karma0

Object of class "karma.fit" or "ARIMA".

y

A univariate time-series vector; type <numeric> or <ts>.

test_pct

Percentage of train-test split in cross-validation (e.g. 70-30), positive integer for "window" or "percentage" test_type; "auto" to read from karma.fit object or generate; negative integer value to set window size to a multiple of the series' frequency.

test_type

Train-test split type, i.e. percentage or fixed window; "auto": will try to read from karma.fit object or generate; "percentage": test_pct = 12 will be read as the 12 percent of the length of the series; "window": test_pct = 12 will be read as the 12 last time points (e.g. months) of the series; "auto" if input series is a ts() object, test_type is set to "window" and test_pct is set to twice the frequency of the series - if test_pct is given a negative factor, then test_pct (window size) will be set to the frequency of the series times the absolute value of that negative number.

metric

Choose a model validation metric that will be used as the main optimisation criterion during model selection.

xreg

Optional vector or matrix of exogenous regressors; see documentation for Arima(), package 'forecast'.

fixed

Fixed term flag. Indicate whether the fixed term option in Arima() needs to be switched on during model selection; T, F; type <logical>.

plot

Option to depict plots during local search; if TRUE (default), AC and PAC plots are active. <logical>

cv

Choose cross-validation dataset to be used during model selection; "out": Performance of out-of-sample forecast (classic train/test split) will be used for model validation; "in": Performance of in-sample forecast (classic parametric regression type of validation) will be used for model validation.

stdout

Option to output optimisation diagnostics during local search; <logical>

Value

Object of class "karma.fit"; (extends class "Arima" from package 'forecast').

See Also

tseries, forecast

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Compatible with "forecast" package objects: Arima, auto.arima, nnetar, ets, bats, tbats, baggedETS, HoltWinters
# Using auto.karma():
karma.cv(auto.karma(y), cv="in")  # in-sample forecast
karma.cv(auto.karma(y), cv="out")    # out-of-sample forecast
# Using karma.fit()
karma.cv(karma.fit(y, order=c(2,1,4))); 
# Using karma.fit() with fixed terms:
karma.cv( karma.fit(y, order=list(c(1,2), 0, c(3,4)), fixed=T) ); 
# Using auto.arima():
karma.cv(auto.arima(y));
#' # Using nnetar():
karma.cv(nnetar(y));
#' # Using ets():
karma.cv(ets(y));

snarf-snarf/karma documentation built on May 24, 2019, 7:19 a.m.