predict.glinternet.cv {glinternet} | R Documentation |
Make predictions from a "glinternetCV" object.
Description
Similar to other predict methods, this function returns fitted values on the response scale. Also gives the option to return the link function.
Usage
## S3 method for class 'glinternet.cv'
predict(object, X, type = c("response", "link"),
lambdaType=c("lambdaHat", "lambdaHat1Std"), ...)
Arguments
object |
|
X |
Matrix of new values for which to make predictions. Must have the same number of variables as during training the model, and all the variables must have the same number of levels. |
type |
Return fitted |
lambdaType |
|
... |
Not used. |
Details
Makes predictions using the model fitted at the appropriate lambda value.
Value
A vector of predicted values.
Author(s)
Michael Lim and Trevor Hastie
Maintainer: Michael Lim michael626@gmail.com
See Also
glinternet
, glinternet.cv
, predict.glinternet
Examples
Y = rnorm(100)
numLevels = sample(1:5, 10, replace=TRUE)
X = sapply(numLevels, function(x) if (x==1)
rnorm(100) else sample(0:(x-1), 100, replace=TRUE))
fit = glinternet.cv(X, Y, numLevels, nFolds=3)
max(abs(fit$fitted - predict(fit, X)))