predict.pcLasso {pcLasso}R Documentation

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 class '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.

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.

Value

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

See Also

pcLasso.

Examples

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, ])


[Package pcLasso version 1.2 Index]