View source: R/coef.cv.ernet.R
coef.cv.ernet | R Documentation |
This function gets coefficients from a cross-validated ernet model, using
the fitted cv.ernet
object, and the optimal value chosen for
lambda
.
## S3 method for class 'cv.ernet' coef(object, s = c("lambda.1se", "lambda.min"), ...)
object |
fitted |
s |
value(s) of the penalty parameter |
... |
not used. Other arguments to predict. |
This function makes it easier to use the results of cross-validation to get coefficients or make coefficient predictions.
The object returned depends the ... argument which is passed on
to the predict
method for ernet
objects.
Yuwen Gu and Hui Zou
Maintainer: Yuwen Gu <yuwen.gu@uconn.edu>
cv.ernet
, predict.cv.ernet
set.seed(1) n <- 100 p <- 400 x <- matrix(rnorm(n * p), n, p) y <- rnorm(n) tau <- 0.90 pf <- abs(rnorm(p)) pf2 <- abs(rnorm(p)) lambda2 <- 1 m1.cv <- cv.ernet(y = y, x = x, tau = tau, eps = 1e-8, pf = pf, pf2 = pf2, standardize = FALSE, intercept = FALSE, lambda2 = lambda2) as.vector(coef(m1.cv, s = "lambda.min"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.