predict.stepplr: prediction function for step.plr

Description Usage Arguments Author(s) References See Also Examples

View source: R/step.plr.R

Description

This function computes the linear predictors, probability estimates, or the class labels for new data, using a stepplr object.

Usage

1
2
3
  ## S3 method for class 'stepplr'
predict(object, x = NULL, newx = NULL,
        type = c("link", "response", "class"), ...)

Arguments

object

stepplr object

x

matrix of features used for fitting object. If newx is provided, x must be provided as well.

newx

matrix of features at which the predictions are made. If newx=NULL, predictions for the training data are returned.

type

If type=link, the linear predictors are returned; if type=response, the probability estimates are returned; and if type=class, the class labels are returned. Default is type=link.

...

other options for prediction

Author(s)

Mee Young Park and Trevor Hastie

References

Mee Young Park and Trevor Hastie (2008) Penalized Logistic Regression for Detecting Gene Interactions

See Also

stepplr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n <- 100
p <- 5
x0 <- matrix(sample(seq(3), n * p, replace=TRUE), nrow=n)
x0 <- cbind(rnorm(n), x0)
y <- sample(c(0, 1), n, replace=TRUE)
level <- vector("list", length=6)
for (i in 2:6) level[[i]] <- seq(3)
fit <- step.plr(x0, y, level=level)
x1 <- matrix(sample(seq(3), n * p, replace=TRUE), nrow=n)
x1 <- cbind(rnorm(n), x1)
pred1 <- predict(fit, x0, x1, type="link")
pred2 <- predict(fit, x0, x1, type="response")
pred3 <- predict(fit, x0, x1, type="class")

stepPlr documentation built on Jan. 28, 2018, 5:04 p.m.