plot_weibull() plots the Kaplan-Meier estimate on the scale where a distribution's survival
curve is a straight line in log time: \(\log(-\log S(t))\) for the Weibull,
\(\Phi^{-1}(1 - S(t))\) for the log-normal, and \(\log((1 - S(t)) / S(t))\) for the
log-logistic. Points close to a straight line support the distribution. For a fit with groups,
parallel lines support proportional hazards (Weibull) or proportional odds (log-logistic) as
well.
Usage
plot_weibull(
fit,
aft = NULL,
dist = c("weibull", "lognormal", "loglogistic"),
title = NULL,
xlab = "log(time)",
ylab = NULL
)Arguments
- fit
A
kaplan_meier()fit.- aft
An optional
aft()fit to overlay.- dist
The distribution:
"weibull"(the default),"lognormal", or"loglogistic".- title
An optional plot title.
- xlab, ylab
The axis labels. The default
ylabdepends ondist.
Details
An aft() fit of the same distribution (or an exponential one, for the Weibull) adds its
fitted line, dashed, at the mean linear predictor. The overlay needs a fit without groups.
Examples
fit <- kaplan_meier(Surv(time, status) ~ sex, data = lung)
plot_weibull(fit)
pooled <- kaplan_meier(Surv(time, status) ~ 1, data = lung)
weibull <- aft(Surv(time, status) ~ 1, data = lung, dist = "weibull")
plot_weibull(pooled, aft = weibull)