predict.glmnetsurv: Prediction for glmnetsurv model

View source: R/glmnetsurvfit.R

predict.glmnetsurvR Documentation

Prediction for glmnetsurv model

Description

Compute fitted values and model terms for the glmnetsurv model.

Usage

## S3 method for class 'glmnetsurv'
predict(
  object,
  ...,
  newdata = NULL,
  type = c("lp", "risk", "terms"),
  terms = names(object$assign),
  na.action = na.pass
)

Arguments

object

fitted glmnetsurv object

...

for future implementations.

newdata

optional data frame containing the variables appearing on the right hand side of glmnetsurv formula. If absent, the predictions are for the data frame used in the original fit.

type

the type of predicted value. Either linear predictor ("lp"), the risk score ("risk" equivalently exp(lp)) and the terms of linear predictor ("terms").

terms

if type = "terms", this argument can be used to specify which terms to be return. Default is all.

na.action

defines the missing value action for the newdata. If newdata is absent, then the behavior of missing is dictated by the na.action option of the original fit.

Details

The computation of these predictions similar to those in predict.coxph. Our current implementation does not incorporate stratification.

Value

a vector of predictions, depending on the type.

Examples


data(veteran, package="survival")
# Penalized
lam <- 0.02
alp <- 1
gfit1 <- glmnetsurv(Surv(time, status) ~ factor(trt) + karno + diagtime + age + prior
	, data = veteran
	, alpha = alp
	, lambda = lam
)
predict(gfit1)


CYGUBICKO/glmnetpostsurv documentation built on Sept. 1, 2022, 7:26 p.m.