predict.grpnet | R Documentation |
Similar to other predict methods, this functions predicts linear predictors,
coefficients and more from a fitted "grpnet"
object.
## S3 method for class 'grpnet'
predict(
object,
newx,
lambda = NULL,
type = c("link", "response", "coefficients"),
newoffsets = NULL,
...
)
## S3 method for class 'grpnet'
coef(object, lambda = NULL, ...)
object |
Fitted |
newx |
Matrix of new values for |
lambda |
Value(s) of the penalty parameter |
type |
Type of prediction required. Type |
newoffsets |
If an offset is used in the fit, then one must be supplied
for making predictions (except for |
... |
Currently ignored. |
The shape of the objects returned are different for "multinomial"
and "multigaussian"
objects
coef(...)
is equivalent to predict(type="coefficients",...)
The object returned depends on type.
James Yang, Trevor Hastie, and Balasubramanian Narasimhan
Maintainer: Trevor Hastie
hastie@stanford.edu
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 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2405.08631")}.
Adelie Python user guide https://jamesyang007.github.io/adelie/
grpnet
, and print
, and coef
methods, and
cv.grpnet
.
set.seed(0)
n <- 100
p <- 200
X <- matrix(rnorm(n * p), n, p)
y <- X[,1] * rnorm(1) + rnorm(n)
fit <- grpnet(X, glm.gaussian(y))
coef(fit)
predict(fit,newx = X[1:5,])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.