Learn R Programming

uniLasso (version 2.11)

predict.cv.uniReg: make predictions from a "cv.uniReg" object.

Description

This function makes predictions from a cross-validated uniReg model, using the stored "glmnet.fit" object, and by default the smallest value of lambda used.

Usage

# S3 method for cv.uniReg
predict(object, newx, s = c("zero", "lambda.1se", "lambda.min"), ...)

Value

The object returned depends on the ... argument which is passed on to the predict method for glmnet objects.

Arguments

object

Fitted "cv.uniReg".

newx

Matrix of new values for x at which predictions are to be made. Must be a matrix; can be sparse as in Matrix package. See documentation for predict.glmnet.

s

Value(s) of the penalty parameter lambda at which predictions are required. Default is the value s="zero" which corresponds to the smallest value of lambda used. Alternatively s="lambda.1se" or s="lambda.min" can be used. If s is numeric, it is taken as the value(s) of lambda to be used.

...

Not used. Other arguments to predict.

Author

Trevor Hastie and Rob Tibshirani
Maintainer: Trevor Hastie hastie@stanford.edu

Details

This function makes it easier to use the results of cross-validation to make a prediction.

See Also

print, and coef methods, and cv.uniReg.

Examples

Run this code

x = matrix(rnorm(100 * 20), 100, 20)
y = rnorm(100)
cv.fit = cv.uniReg(x, y)
predict(cv.fit, newx = x[1:5, ])
coef(cv.fit)

Run the code above in your browser using DataLab