R/cv.R
mc_cv.Rd
New function to compute optimal value of regularization parameter based on K-fold cross-validation
mc_cv(
fit,
Kfold = 5,
nweight = NULL,
weighting = TRUE,
wtype = "size",
type = "MSFE",
l1length = 100,
normalize = TRUE
)
fitted object returned from mc_reg()
K-fold cross-validation
vector of length K indicating weights for MSFE measure
MSFE or MAFE
length sparsity grid l1 penalty
flag: asymmetric forecast error measure or not
A list with the following components
list of the training splits used
list of the testing splits used
List of length Kfold. Each element is a mc_reg() object that was fit on a training split.
A data frame of forecast errors. Includes CV prediction (yhat), observed value (y), class and knot.
One MSFE and MAFE for each fold, knot, class combination.
One MSFE and MAFE for each knot and each class.
One MSFE and MAFE for each knot.
One MSFE and MAFE for each fold and each class.
One MSFE and MAFE for each class.
One overall MSFE and MAFE for the pooled model.
Data frame with the coefficients from the full fitted model that correspond to the optimal knot as defined by MSFE cross validation, this is a subset of fit$coef_df
which is supplied as an argument to the CV function.
Data frame with the coefficients from the full fitted model that correspond to the optimal knot as defined by MAFE cross validation, this is a subset of fit$coef_df
which is supplied as an argument to the CV function.