Learn R Programming

rms (version 4.1-3)

survest.psm: Parametric Survival Estimates

Description

Computes predicted survival probabilities or hazards and optionally confidence limits (for survival only) for parametric survival models fitted with psm. If getting predictions for more than one observation, times must be specified. For a model without predictors, no input data are specified.

Usage

## S3 method for class 'psm':
survest(fit, newdata, linear.predictors, x, times, fun,
        loglog=FALSE, conf.int=0.95,
        what=c("survival","hazard","parallel"), ...)

## S3 method for class 'survest.psm': print(x, \dots)

Arguments

fit
fit from psm
newdata, linear.predictors, x, times, conf.int
see survest.cph. One of newdata, linear.predictors, x must be given. linear.predictors includes the intercept. If times is omitted, predictions are made at 200 equally spaced po
what
The default is to compute survival probabilities. Set what="hazard" or some abbreviation of "hazard" to compute hazard rates. what="parallel" assumes that the length of times is the number of subjects (
loglog
set to TRUE to transform survival estimates and confidence limits using log-log
fun
a function to transform estimates and optional confidence intervals
...
unused

Value

  • see survest.cph. If the model has no predictors, predictions are made with respect to varying time only, and the returned object is of class "survfit" so the survival curve can be plotted with survplot.survfit. If times is omitted, the entire survival curve or hazard from t=0,...,fit$maxtime is estimated, with increments computed to yield 200 points where fit$maxtime is the maximum survival time in the data used in model fitting. Otherwise, the times vector controls the time points used.

Details

Confidence intervals are based on asymptotic normality of the linear predictors. The intervals account for the fact that a scale parameter may have been estimated jointly with beta.

See Also

psm, survreg, rms, survfit, predictrms, survplot, survreg.distributions

Examples

Run this code
# Simulate data from a proportional hazards population model
n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50))
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- "Year"
S <- Surv(dt,e)

f <- psm(S ~ lsp(age,c(40,70)))
survest(f, data.frame(age=seq(20,80,by=5)), times=2)

#Get predicted survival curve for 40 year old
survest(f, data.frame(age=40))

#Get hazard function for 40 year old
survest(f, data.frame(age=40), what="hazard")$surv #still called surv

Run the code above in your browser using DataLab