Description Usage Arguments Value Author(s) See Also Examples
Performs k-fold cross validation for MCP penalized regression models over a grid of values for parameter λ and κ.
1 | cv.sparsenet(result, X, y, delta, n_lambda = 100, n_kappa = 1, kappa0 = 1/3, lambda0 = -1, eps = 1e-06, max.iter = 100, method = "include", power = 2, fold = 5, weight = NA, AFT = TRUE, penalty = "MCP", stratified = TRUE)
|
result |
a list consists of result from weighted.sparsenet. |
X |
Design matrix of size \eqn{n} by \eqn{p}, where \eqn{n} is the sample size and \eqn{p} is the number of variables. This is the original design matrix. |
y |
Response vector of length n. This is the original response variable. |
delta |
Indicator vector of length n. Useful when |
n_lambda |
number of lambda values in the grid. Default value is 100. |
n_kappa |
number of kappa values in the grid. Default value is 1. |
kappa0 |
Maximum value of κ. Default value is 1/3. |
lambda0 |
Maximum value of λ. Default value is -1. If |
eps |
Convergence threshhold. The algorithm iterates until the relative change in any coefficient is less than eps. Default is 1e-6. |
max.iter |
Maximum number of iteration. Default is 100. |
method |
Character. Either "exclude" or "include". If |
power |
Specifies the power of the loss function in cross validation. Default is 2. |
fold |
Number of folds in cross validation. Default is 5. |
weight |
Only useful when |
AFT |
Logical. If |
penalty |
The penalty to be added to the objective function. Values could be "MCP" (the default), "SCAD" or "adaptive" for MCP, SCAD and adaptive LASSO penalties, respectively. LASSO result is automatically computed. |
stratified |
Logical. This indicates whether stratified sampling should be used in the cross-validation. If |
A list of results.
betalasso |
The fitted vector of coefficients with LASSO penalty. The length is equal to the number of coefficients in the model. |
betamcp |
The fitted vector of coefficients with MCP penalty. The length is equal to the number of coefficients in the model. |
betascad |
The fitted vector of coefficients with SCAD penalty. The length is equal to the number of coefficients in the model. |
lasso.lambda |
The best lambda value chosen by BIC criteria when LASSO is used as the penalty function. |
mcp.lambda |
The best lambda value chosen by BIC criteria when MCP is used as the penalty function. |
mcp.kappa |
The best kappa value chosen by BIC criteria when MCP is used as the penalty function. |
scad.lambda |
The best lambda value chosen by BIC criteria when SCAD is used as the penalty function. |
scad.kappa |
The best kappa value chosen by BIC criteria when SCAD is used as the penalty function. |
name.lasso |
The names associated with the selected variables by LASSO penalty. |
name.mcp |
The names associated with the selected variables by MCP penalty. |
Hao Chai <hao.chai@yale.edu>
1 2 3 4 5 6 | X = matrix(rnorm(8000), nrow = 20)
beta0 = c(rep(10, 5), rep(0, 395))
y = rnorm(20) + X %*% beta0
delta = rep(1, 20)
result = weighted.sparsenet(X, y, delta, n_kappa = 40, kappa0 = 0.99)
cv.sparsenet(result, X, y, delta, n_kappa = 40, kappa0 = 0.99)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.