Intended as a quick check of the results of a model fit. See
plot_survival
and plot_hazard
for
the functions behind each panel, and survival
and hazard
to extract the data being plotted here
to enable custom plots like these.
Usage
# S3 method for survextrap
plot(x, type = "hazsurv", newdata = NULL, ...)
Arguments
- x
A fitted model object as returned by
survextrap
- type
"survival"
for a plot of the survival function,"hazard"
for the hazard function, against time.- newdata
Data frame of covariate values to compute the output for. If there are covariates in the model and this is not supplied, the following default is used:
(a) if the only covariate is one factor variable, then the output is computed for each level of this factor.
(b) if there are multiple covariates, or any numeric covariates, then the output is computed at the mean of each numeric covariate in the original data, and at the baseline level of each factor covariate.
Note caution is required about how treatment groups (for example) are stored in your data. If these are coded as numeric (0/1), then if
newdata
is not specified only one output will be shown, which relates to the average value of this numeric variable over the data, which doesn't correspond to either of the treatment groups. To avoid this, a treatment group should be stored as a factor.- ...
Additional arguments, passed on to
plot_hazard
andplot_survival
.