predict: Prediction based on penfit objects

Description Usage Arguments Details Value Examples

Description

Predicting a response for new subjects based on a fitted penalized regression model.

Usage

1
2
## S4 method for signature 'penfit'
predict(object, penalized, unpenalized, data)

Arguments

object

The fitted model (a penfit object).

penalized

The matrix of penalized covariates for the new subjects.

unpenalized

The unpenalized covariates for the new subjects.

data

A data.frame used to evaluate the terms of penalized or unpenalized when these have been specified as a formula object.

Details

The user need only supply those terms from the original call that are different relative to the original call that produced the penfit object. In particular, if penalized and/or unpenalized was specified in matrix form, a matrix must be given with the new subjects' data. The columns of these matrices must be exactly the same as in the matrices supplied in the original call that produced the penfit object. If either penalized or unpenalized was given as a formula in the original call, the user of predict must supply a new data argument. As with matrices, the new data argument must have a similar make-up as the data argument in the original call that produced the penfit object. In particular, any factors in data must have the same levels.

Value

The predictions, either as a vector (logistic and Poisson models), a matrix (linear model), or a breslow object (Cox model).

Examples

1
2
3
4
5
6
data(nki70)

pen <- penalized(Surv(time, event), penalized = nki70[1:50,8:77],
    unpenalized = ~ER+Age+Diam+N+Grade, data = nki70[1:50,], lambda1 = 10)

predict(pen, nki70[51:52,8:77], data = nki70[51:52,])

penalized documentation built on May 2, 2019, 7:28 a.m.