cv.hqreg(X, y, ..., nfolds=10, fold.id, type.measure = c("deviance", "mse", "mae"),
seed, trace=FALSE)hqreg.hqreg.hqreg.cv.hqreg."cv.hqreg", which is a list containing:lambda, averaged across the cross-validation folds.cve.lambda used in the cross-validation fits.hqreg object for the whole data.lambda such that the error is within 1 standard
error of the minimum.lambda with the minimum cross-validation error.nfolds. It calls hqreg
nfolds+1 times, the first to obtain the lambda sequence, and the remainder
to fit with each of the folds left out once for validation. The cross-validation error is
the average of validation errors for the nfolds fits.Note that cv.hqreg does not search for values of alpha, gamma or tau.
Specific values should be supplied, otherwise the default ones for hqreg are used.
If users would like to cross-validate alpha, gamma or tau as well,
they should call cv.hqreg for each combination of these parameters and use the same
"seed" in these calls so that the partitioning remains the same.
hqreg, plot.cv.hqregX = matrix(rnorm(1000*100), 1000, 100)
beta = rnorm(10)
eps = 4*rnorm(1000)
y = drop(X[,1:10] %*% beta + eps)
cv = cv.hqreg(X, y, seed = 123)
plot(cv)
predict(cv, X[1:5,])Run the code above in your browser using DataLab