Learn R Programming

survival (version 2.34-1)

predict.coxph: Predictions for 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
A coxph object
newdata
Optional new data to predict at
type
Type of prediction wanted
se.fit
Return standard errors as well?
terms
If type="terms", which terms to return.
collapse
identifier for which rows correspond to different individuals
safe
Use a more intensive `safe' prediction method
...
other unused arguments

Value

  • A vector or matrix of fitted values. If se.fit=TRUE a list whose first component is the fitted values and second is the standard errors.

See Also

predict,coxph,termplot

Examples

Run this code
fit<-coxph(Surv(time,status)~x,data=aml)
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)

Run the code above in your browser using DataLab