Implements a cross validation method for ARFIMAX models
arfimacv(data, indexin, indexout, ar.max = 2, ma.max = 2,
criterion = c("rmse","mae","berkowitzp"),berkowitz.significance = 0.05,
arfima = FALSE, include.mean = NULL, distribution.model = "norm",
cluster = NULL, external.regressors = NULL, solver = "solnp",
solver.control=list(), fit.control=list(), return.best=TRUE)
A list with the following items:
The best model based on the criterion chosen is re-estimated on the complete data set and returned.
The model combinations and their average criteria statistics across the training/testing sets.
A univariate xts vector.
A list of the training set indices
A list of the testing set indices, the same list length as that of indexin. This should be a numeric index of points immediately after those in the equivalent indexin slot and contiguous (for time series cross validation).
Maximum AR order to test for.
Maximum MA order to test for.
The cv criterion on which the forecasts will be tested against the realized values. Currently “rmse”, “mae” and experimentally “berkowitzp” are implemented. The latter is the Berkowitz test p-value (maximized) and should not be used if your indexout set is very small.
The significance level at which the Berkowitz test is evaluated at (this has no value at the moment since we are only looking at the p-values, but may be used in futures to instead aggregate across pass-fail).
Can be TRUE, FALSE or NULL in which case it is tested.
Can be TRUE, FALSE or NULL in which case it is tested.
A cluster object created by calling makeCluster
from the parallel
package. If it is not NULL, then this will be used for parallel estimation.
An xts matrix object containing the pre-lagged external regressors to include in the mean equation with the same indices as those of the data supplied.
The distribution density to use for the innovations (defaults to Normal).
One of either “nlminb”, “solnp”, “gosolnp” or “nloptr”.
Control arguments list passed to optimizer.
Control arguments passed to the fitting routine.
On completion of the cross-validation, should the best model be re-estimated on the complete dataset and returned (defaults to TRUE).
Alexios Ghalanos
The function evaluates all possible combinations of the ARFIMAX model for all the training and testing sets supplied. For the ARMA orders, the orders are evaluated fully (e.g. for ar.max=2, all possible combinations are evaluated including AR(0,0), AR(0,1), AR(0,2), AR(1,0), AR(2,0) AR(1,2), AR(2,1), and AR(2,2)). For each training set in indexin, all model combinations are evaluated and the 1-ahead rolling forecast for the indexout testing set is produced and compared to the realized values under the 3 criteria listed. Once all training/testing is done on all model combinations, the criteria are averaged across all the sets for each combination and the results returned.