predict.coxph {survival}R Documentation

Predictions for a Cox model

Description

Compute fitted values and regression terms for a model fitted by coxph

Usage

## S3 method for class 'coxph':
predict(object, newdata,
type=c("lp", "risk", "expected", "terms"),
se.fit=FALSE, terms=names(object$assign), collapse,
safe=FALSE, ...)

Arguments

object the results of a coxph fit.
newdata Optional new data at which to do predictions. If absent predictions are for the data frame used in the original fit.
type the type of predicted value. Choices are the linear predictor ("lp"), the risk score exp(lp) ("risk"), the expected number of events given the covariates and follow-up time ("expected"), and the terms of the linear predictor ("terms").
se.fit if TRUE, pointwise standard errors are produced for the predictions.
terms if type="terms", this argument can be used to specify which terms should be included; the default is all.
collapse optional vector of subject identifiers. If specified, the output will contain one entry per subject rather than one entry per observation.
safe not used in R
... For future methods

Value

a vector or matrix of predictions, or a list containing the predictions (element "fit") and their standard errors (element "se.fit") if the se.fit option is TRUE.

See Also

predict,coxph,termplot

Examples

fit <- coxph(Surv(time, status) ~ age + ph.ecog + strata(inst), lung) 
mresid <- lung$status - predict(fit, type='expected') #Martingale resid 
predict(fit,type="lp")
predict(fit,type="risk")
predict(fit,type="expected")
predict(fit,type="terms")
predict(fit,type="lp",se.fit=TRUE)
predict(fit,type="risk",se.fit=TRUE)
predict(fit,type="expected",se.fit=TRUE)
predict(fit,type="terms",se.fit=TRUE)

[Package survival version 2.35-4 Index]