Learn R Programming

rms (version 6.1-0)

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 psm
survest(fit, newdata, linear.predictors, x, times, fun,
        loglog=FALSE, conf.int=0.95,
        what=c("survival","hazard","parallel"), …)

# S3 method for survest.psm print(x, …)

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 points between 0 and the maximum failure/censoring time used to fit the model.

x can also be a result from survest.psm.

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 (or one), and causes survest to estimate the \(i^{th}\) subject's survival probability at the \(i^{th}\) value of times (or at the scalar value of times). what="parallel" is used by val.surv for example.

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 "npsurv" so the survival curve can be plotted with survplot.npsurv. 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
# NOT RUN {
# 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