predict.cv.glmnet
From glmnet v2.05
by Trevor Hastie
make predictions from a "cv.glmnet" object.
This function makes predictions from a crossvalidated glmnet model,
using the stored "glmnet.fit"
object, and the optimal value
chosen for lambda
.
 Keywords
 models, regression
Usage
"predict"(object, newx, s=c("lambda.1se","lambda.min"),...)
"coef"(object,s=c("lambda.1se","lambda.min"),...)
Arguments
 object
 Fitted
"cv.glmnet"
object.  newx
 Matrix of new values for
x
at which predictions are to be made. Must be a matrix; can be sparse as inMatrix
package. See documentation forpredict.glmnet
.  s
 Value(s) of the penalty parameter
lambda
at which predictions are required. Default is the values="lambda.1se"
stored on the CVobject
. Alternativelys="lambda.min"
can be used. Ifs
is numeric, it is taken as the value(s) oflambda
to be used.  ...
 Not used. Other arguments to predict.
Details
This function makes it easier to use the results of crossvalidation to make a prediction.
Value

... argument which is passed on
to the
predict
method for glmnet
objects.References
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://wwwstat.stanford.edu/~hastie/Papers/glmnet.pdf http://www.jstatsoft.org/v33/i01/
See Also
glmnet
, and print
, and coef
methods, and cv.glmnet
.
Examples
library(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))
Community examples
Looks like there are no examples yet.