predict.cpernet {SALES}R Documentation

Make predictions from a cpernet object

Description

Similar to other predict methods, this function predicts fitted values from a cpernet object.

Usage

## S3 method for class 'cpernet'
predict(object, newx, s = NULL, type = "response", ...)

Arguments

object

fitted cpernet model object.

newx

matrix of new values for x at which predictions are to be made. NOTE: newx must be a matrix, predict function does not accept a vector or other formats of newx.

s

value(s) of the penalty parameter lambda at which predictions are to be made. Default is the entire sequence used to create the model.

type

type of prediction required. Only response is available. Gives predicted response for regression problems.

...

Not used. Other arguments to predict.

Details

s is the new vector at which predictions are to be made. If s is not in the lambda sequence used for fitting the model, the predict function will use linear interpolation to make predictions. The new values are interpolated using a fraction of predicted values from both left and right lambda indices.

Value

The object returned depends on type.

Author(s)

Yuwen Gu and Hui Zou

Maintainer: Yuwen Gu <yuwen.gu@uconn.edu>

See Also

cpernet, coef.cpernet, plot.cpernet, print.cpernet

Examples


set.seed(1)
n <- 100
p <- 400
x <- matrix(rnorm(n * p), n, p)
y <- rnorm(n)
tau <- 0.30
pf <- abs(rnorm(p))
pf2 <- abs(rnorm(p))
w <- 2.0
lambda2 <- 1
m2 <- cpernet(y = y, x = x, w = w, tau = tau, eps = 1e-8,
              pf.mean = pf, pf.scale = pf2,
              standardize = FALSE, lambda2 = lambda2)
predict(m2, newx = x, s = m2$lambda[50])


[Package SALES version 1.0.2 Index]