predict.cv.glmnet {glmnet} | R Documentation |
This function makes predictions from a cross-validated glmnet model,
using the stored "glmnet.fit"
object, and the optimal value
chosen for lambda
.
## S3 method for class 'cv.glmnet' predict(object, newx, s=c("lambda.1se","lambda.min"),...) ## S3 method for class 'cv.glmnet' coef(object,s=c("lambda.1se","lambda.min"),...)
object |
Fitted |
newx |
Matrix of new values for |
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 make a prediction.
The object returned depends the ... argument which is passed on
to the predict
method for glmnet
objects.
Jerome Friedman, Trevor Hastie and Rob Tibshirani
Maintainer: Trevor Hastie <hastie@stanford.edu>
Friedman, J., Hastie, T. and Tibshirani, R. (2008)
Regularization Paths for Generalized Linear Models via Coordinate
Descent, Journal of Statistical Software, Vol. 33, Issue 1, Feb 2010
http://www.jstatsoft.org/v33/i01/
glmnet
, and print
, and coef
methods, and cv.glmnet
.
x=matrix(rnorm(100*20),100,20) y=rnorm(100) cv.fit=cv.glmnet(x,y) predict(cv.fit,newx=x[1:5,]) coef(cv.fit) coef(cv.fit,s="lambda.min") predict(cv.fit,newx=x[1:5,],s=c(0.001,0.002))