pcLasso (version 1.1)

predict.pcLasso: Make predictions from a "pcLasso" object

Description

This function returns the predictions from a "pcLasso" object for a new data matrix.

Usage

# S3 method for pcLasso
predict(object, xnew, ...)

Arguments

object

Fitted "pcLasso" object.

xnew

Matrix of new values for x at which predictions are to be made.

...

Potentially other arguments to be passed to and from methods; currently not in use.

Value

Predictions of \(E(y|xnew)\) which the model object makes at xnew. These are probabilities for the binomial family.

Details

Note that xnew should have the same number of columns as the original feature space, regardless of whether the groups are overlapping or not.

See Also

pcLasso.

Examples

Run this code
# NOT RUN {
set.seed(1)
x <- matrix(rnorm(100 * 20), 100, 20)

# family = "gaussian"
y <- rnorm(100)
fit1 <- pcLasso(x, y, ratio = 0.8)
predict(fit1, xnew = x[1:5, ])

# family = "binomial"
y2 <- sample(0:1, 100, replace = TRUE)
fit2 <- pcLasso(x, y2, ratio = 0.8, family = "binomial")
predict(fit2, xnew = x[1:5, ])

# }

Run the code above in your browser using DataCamp Workspace