Arguments

Matrix of covariate values to produce fitted values
for. Columns represent different covariates, and rows represent
multiple combinations of covariate values.
For example matrix(c(1,2),nrow=2) if there
is only one covariate in the model, and we want survival for
covariate values of 1 and 2.

For “factor” (categorical) covariates, the values of the contrasts
representing factor levels (as returned by the
contrasts function) should be used. For example, for
a covariate agegroup specified as an unordered factor with
levels 20-29, 30-39, 40-49, 50-59, and baseline level
20-29, there are three contrasts. To return summaries for
groups 20-29 and 40-49, supply
X = rbind(c(0,0,0), c(0,1,0)),
since all contrasts are zero for the baseline level, and the second
contrast is “turned on” for the third level 40-49.

If there are only factor covariates in the model, then all distinct
groups are used by default.

If there are any continuous covariates, then a single summary is
provided. By default, this is with all
covariates set to their mean values in the data - for categorical
covariates, the means of the 0/1 indicator variables are taken.

type

"survival" for survival probabilities.

"cumhaz" for cumulative hazards.

"hazard" for hazards.

t

Times to calculate fitted values for. By default, these are the
sorted unique observation (including censoring) times in the
data. If the corresponding left-truncation times start are not
supplied, then they all default to 0.

start

Left-truncation times, defaults to those corresponding
to the default t in the data.

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
B=0 to turn off calculation of CIs.

cl

Width of symmetric confidence intervals, relative to 1.

...

Further arguments passed to or from other methods.

Value

A list with one element for each unique covariate value (if there are
only categorical covariates) or one element (if there are no
covariates or any continuous covariates). Each of these elements
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 elements are named with the covariate
names and values which define them.

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 model-based summaries against empirical summaries such as
Kaplan-Meier curves, to diagnose model fit.

Confidence intervals for models fitted with flexsurvreg
are obtained by random sampling from the asymptotic normal
distribution of the maximum likelihood estimates (see, e.g. Mandel
(2013)). For models fitted
with flexsurvreg, intervals for the hazard are obtained
in this way, whereas intervals for the survival and cumulative hazard
are obtained analytically as in Royston and Parmar (2002).