Crossvalidation for hqreg
Description
Perform kfold cross validation for elasticnet penalized Huber loss regression and quantile regression over a sequence of lambda values and find an optimal lambda.
Usage
1 2 
Arguments
X 
The input matrix, as in 
y 
The response vector, as in 
... 
Additional arguments to 
ncores 

nfolds 
The number of crossvalidation folds. Default is 10. 
fold.id 
(Optional) a vector of values between 1 and nfold indicating
which fold each observation belongs to. If supplied, nfolds can be missing.
By default the observations are randomly assigned by 
type.measure 
The default is "deviance", which uses the chosen loss function of the model. Other options include "mse" for mean squared error and "mae" for mean absolute error. 
seed 
(Optional) Seed for the random number generator in order to obtain reproducible results. 
Details
The function randomly partitions the data in 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 crossvalidation 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 crossvalidate 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.
Value
The function returns an object of S3 class "cv.hqreg"
, which is a list containing:
cve 
The error for each value of 
cvse 
The estimated standard error associated with each value of 
type.measure 
Same as above. 
lambda 
The values of 
fit 
The fitted 
lambda.1se 
The largest 
lambda.min 
The value of 
Author(s)
Congrui Yi <congruiyi@uiowa.edu>
See Also
hqreg
, plot.cv.hqreg
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.