survest.psm | R Documentation |
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.
## 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, ...)
fit |
fit from |
newdata , linear.predictors , x , times , conf.int |
see
|
what |
The default is to compute survival probabilities. Set |
loglog |
set to |
fun |
a function to transform estimates and optional confidence intervals |
... |
unused |
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 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.
Frank Harrell
Department of Biostatistics
Vanderbilt University
fh@fharrell.com
psm
, survreg
, rms
, survfit
, predictrms
, survplot
,
survreg.distributions
# Simulate data from a proportional hazards population model
require(survival)
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.