predict.glinternet.cv {glinternet} | R Documentation |
Similar to other predict methods, this function returns fitted values on the response scale. Also gives the option to return the link function.
## S3 method for class 'glinternet.cv'
predict(object, X, type = c("response", "link"),
lambdaType=c("lambdaHat", "lambdaHat1Std"), ...)
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. |
Makes predictions using the model fitted at the appropriate lambda value.
A vector of predicted values.
Michael Lim and Trevor Hastie
Maintainer: Michael Lim michael626@gmail.com
glinternet
, glinternet.cv
, predict.glinternet
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)))