predict.cv.grpnet {adelie} | R Documentation |
make predictions from a "cv.grpnet" object.
Description
This function makes predictions from a cross-validated grpnet model, using
the stored "grpnet.fit"
object, and the optimal value chosen for
lambda
.
Usage
## S3 method for class 'cv.grpnet'
predict(object, newx, lambda = c("lambda.1se", "lambda.min"), ...)
Arguments
object |
Fitted |
newx |
Matrix of new values for |
lambda |
Value(s) of the penalty parameter |
... |
Other arguments to |
Details
This function makes it easier to use the results of cross-validation to make a prediction.
Value
The object returned depends on the arguments.
Author(s)
James Yang, Trevor Hastie, and Balasubramanian Narasimhan
Maintainer: Trevor Hastie hastie@stanford.edu
References
Yang, James and Hastie, Trevor. (2024) A Fast and Scalable Pathwise-Solver for Group Lasso and Elastic Net Penalized Regression via Block-Coordinate Descent. arXiv doi:10.48550/arXiv.2405.08631.
See Also
grpnet
, and print
, and coef
methods, and
cv.grpnet
.
Examples
x = matrix(rnorm(100 * 20), 100, 20)
y = rnorm(100)
cv.fit = cv.grpnet(x, glm.gaussian(y))
predict(cv.fit, newx = x[1:5, ])
coef(cv.fit)
coef(cv.fit, lambda = "lambda.min")
predict(cv.fit, newx = x[1:5, ], lambda = c(0.001, 0.002))