Return fitted survival, cumulative hazard or hazard
at a series of times from a fitted flexsurvreg
or
flexsurvspline
model.
1 2 3 4 5 
object 
Output from 
newdata 
Data frame containing covariate values to produce fitted values for. Or a list that can be coerced to such a data frame. There must be a column for every covariate in the model formula, and one row for every combination of covariates the fitted values are wanted for. These are in the same format as the original data, with factors as a single variable, not 0/1 contrasts. If this is omitted, if there are any continuous covariates, then a single summary is provided with all covariates set to their mean values in the data  for categorical covariates, the means of the 0/1 indicator variables are taken. If there are only factor covariates in the model, then all distinct groups are used by default. 
X 
Alternative way of defining covariate values to produce
fitted values for. Since version 0.4, Columns of For “factor” (categorical) covariates, the values of the contrasts
representing factor levels (as returned by the

type 
Ignored if 
fn 
Custom function of the parameters to summarise against time. This
has optional first two arguments 
t 
Times to calculate fitted values for. By default, these are the sorted unique observation (including censoring) times in the data  for lefttruncated datasets these are the "stop" times. 
start 
Optional lefttruncation time or times. The returned survival, hazard or cumulative hazard will be conditioned on survival up to this time. A vector of the same length as 
ci 
Set to 
B 
Number of simulations from the normal asymptotic distribution
of the estimates used to calculate confidence intervals. Decrease
for greater speed at the expense of accuracy, or set

cl 
Width of symmetric confidence intervals, relative to 1. 
tidy 
If 
... 
Further arguments passed to or from other methods. Currently unused. 
Timedependent covariates are not currently supported. The covariate values are assumed to be constant through time for each fitted curve.
If tidy=FALSE
, a list with one component for each unique covariate value (if there are
only categorical covariates) or one component (if there are no
covariates or any continuous covariates). Each of these components
is a matrix with one row for each time in t
, giving the
estimated survival (or cumulative hazard, or hazard) and 95%
confidence limits. These list components are named with the covariate
names and values which define them.
If tidy=TRUE
, a data frame is returned instead. This is formed
by stacking the above list components, with additional columns to
identify the covariate values that each block corresponds to.
If there are multiple summaries, an additional list component named
X
contains a matrix with the exact values of contrasts (dummy
covariates) defining each summary.
The plot.flexsurvreg
function can be used to quickly
plot these modelbased summaries against empirical summaries such as
KaplanMeier curves, to diagnose model fit.
Confidence intervals are obtained by random sampling from the asymptotic normal distribution of the maximum likelihood estimates (see, e.g. Mandel (2013)).
C. H. Jackson chris.jackson@mrcbsu.cam.ac.uk
Mandel, M. (2013). "Simulation based confidence intervals for functions with complicated derivatives." The American Statistician (in press).
Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.