Learn R Programming

biglasso (version 1.0-1)

predict.cv.biglasso: Model predictions based on a fitted "cv.biglasso" object.

Description

Extract predictions from a fitted cv.biglasso object.

Usage

"predict"(object, X, row.idx = 1:nrow(X), type = c("link", "response", "class", "coefficients", "vars", "nvars"), lambda = object$lambda.min, which = object$min, ...)
"coef"(object, lambda = object$lambda.min, which = object$min, ...)

Arguments

object
A fitted "cv.biglasso" model object.
X
Matrix of values at which predictions are to be made. It must be a big.matrix object. Not used for type="coefficients".
row.idx
Similar to that in biglasso, it's a vector of the row indices of X that used for the prediction. 1:nrow(X) by default.
type
Type of prediction: "link" returns the linear predictors; "response" gives the fitted values; "class" returns the binomial outcome with the highest probability; "coefficients" returns the coefficients; "vars" returns a list containing the indices and names of the nonzero variables at each value of lambda; "nvars" returns the number of nonzero coefficients at each value of lambda.
lambda
Values of the regularization parameter lambda at which predictions are requested. The default value is the one corresponding to the minimum cross-validation error.
which
Indices of the penalty parameter lambda at which predictions are requested. The default value is the index of lambda corresponding to lambda.min. Note: this is overridden if lambda is specified.
...
Not used.

Value

type.

See Also

biglasso, cv.biglasso

Examples

Run this code
## predict.cv.biglasso
data(heart)
X <- as.matrix(heart[,1:9])
y <- heart$chd
X <- as.big.matrix(X)
## Not run: 
# cvfit <- cv.biglasso(X, y, penalty = 'lasso', family = "binomial")
# coef(cvfit)
# predict(cvfit, X, type = "response")
# predict(cvfit, X, type = "link")
# predict(cvfit, X, type = "class")
# ## End(Not run)

Run the code above in your browser using DataLab