coef.ernet | R Documentation |
Computes the coefficients or returns a list of the indices of the nonzero
coefficients at the requested values for lambda
from a fitted ernet
object.
## S3 method for class 'ernet' coef(object, s = NULL, type = c("coefficients", "nonzero"), ...)
object |
fitted |
s |
value(s) of the penalty parameter |
type |
type |
... |
not used. Other arguments to predict. |
s
is the new vector at which predictions are requested. If
s
is not in the lambda sequence used for fitting the model, the
coef
function will use linear interpolation to make predictions. The
new values are interpolated using a fraction of coefficients from both left
and right lambda
indices.
The object returned depends on type.
Yuwen Gu and Hui Zou
Maintainer: Yuwen Gu <yuwen.gu@uconn.edu>
ernet
, predict.ernet
,
print.ernet
, plot.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 <- ernet(y = y, x = x, tau = tau, eps = 1e-8, pf = pf, pf2 = pf2, standardize = FALSE, intercept = FALSE, lambda2 = lambda2) as.vector(coef(m1, s = m1$lambda[5]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.