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

Description Usage Arguments Details Value See Also Examples

View source: R/predict.pcLasso.R

Description

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

Usage

1
2
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
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, ])

pcLasso documentation built on Sept. 4, 2020, 1:08 a.m.