Warning: this function is depracated and will not be exported in future rqPen releases. Produces penalized quantile regression models for a range of lambdas and penalty of choice. If lambda is unselected than an iterative algorithm is used to find a maximum lambda such that the penalty is large enough to produce an intercept only model. Then range of lambdas goes from the maximum lambda found to "eps" on the log scale. For non-convex penalties local linear approximation approach used by Wang, Wu and Li to extend LLA as proposed by Zou and Li (2008) to the quantile regression setting.
cv.rq.pen(
x,
y,
tau = 0.5,
lambda = NULL,
weights = NULL,
penalty = "LASSO",
intercept = TRUE,
criteria = "CV",
cvFunc = "check",
nfolds = 10,
foldid = NULL,
nlambda = 100,
eps = 1e-04,
init.lambda = 1,
penVars = NULL,
alg = ifelse(ncol(x) < 50, "LP", "QICD"),
internal = FALSE,
...
)
Returns the following:
List of penalized models fit. Number of models will match number of lambdas and correspond to cv$lambda.
Data frame with "lambda" and second column is the evaluation based on the criteria selected.
Lambda which provides the smallest statistic for the selected criteria.
Penalty selected.
Matrix of predictors.
Numeric vector of response values.
Conditional quantile being modelled.
Vector of lambdas. Default is for lambdas to be automatically generated.
Weights for the objective function.
Type of penalty: "LASSO", "SCAD" or "MCP".
Whether model should include an intercept. Constant does not need to be included in "x".
How models will be evaluated. Either cross-validation "CV", BIC "BIC" or large P BIC "PBIC".
If cross-validation is used how errors are evaluated. Check function "check", "SqErr" (Squared Error) or "AE" (Absolute Value).
K for K-folds cross-validation.
Group id for cross-validation. Function will randomly generate groups if not specified.
Number of lambdas for which models are fit.
Smallest lambda used.
Initial lambda used to find the maximum lambda. Not needed if lambda values are set.
Variables that should be penalized. With default value of NULL all variables are penalized.
Algorithm that will be used, either linear programming (LP) or coordinate descent (QICD) algorithm from Peng and Wang (2015).
If this is an internal call to this function.
Additional arguments to be sent to rq.lasso.fit or rq.nc.fit.
Ben Sherwood, ben.sherwood@ku.edu
if (FALSE) {
x <- matrix(rnorm(800),nrow=100)
y <- 1 + x[,1] - 3*x[,5] + rnorm(100)
cv_model <- cv.rq.pen(x,y)
}
Run the code above in your browser using DataLab