View source: R/plot_tranformed_km.R
plot_transformed_km | R Documentation |
Perform an exploratory investigation for linearity of transformed survival models.
plot_transformed_km(fit, mod = 1, add_legend = FALSE, graph = "base", ...)
fit |
An object of class survHE. |
mod |
Index or name of a model in fit. Defaults to 1. |
add_legend |
If |
graph |
Type of plot: base or ggplot2. |
... |
Further arguments, passed on to plot. |
For the Weibull, twice taking logs of the survivor function
log(-log S(t)) = log \lambda + \gamma log t
A plot of log(-log S(t))
against log(t)
would give an approximately
straight line if the Weibull assumption is reasonable.
The plot could also be used to give a rough estimate of the parameters.
Similarly, for the log-logistic distribution
logS(t)/(1 - S(t)) = \theta - \kappa log t
For the log-normal distribution
\Phi^{-1} (1 - S(t)) = (log t - \mu) / \sigma
We can also check the assumption made with using the Cox regression model of proportional hazards by inspecting the log-cumulative hazard plot.
log H_i(t) = \beta x_i + log H_0(t)
The transformed curves for different values of the explanatory variables will be parallel if PH holds.
Diagnostic plot
William Browne, Nathan Green
Collett (2015) Modelling Survival Data in Medical Research, CRC Press
data(bc)
form <- formula("Surv(recyrs, censrec) ~ group")
# exponential distribution
fit_exp <- fit.models(form, data = bc,
distr = "exp", method = "mle")
plot_transformed_km(fit_exp)
plot_transformed_km(fit_exp, graph = "ggplot2")
# weibull distribution
fit_wei <- fit.models(form, data = bc,
distr = "weibull", method = "mle")
plot_transformed_km(fit_wei)
plot_transformed_km(fit_wei, graph = "ggplot2")
# loglogistic distribution
fit_llog <- fit.models(form, data = bc,
distr = "loglogistic", method = "mle")
plot_transformed_km(fit_llog)
plot_transformed_km(fit_llog, graph = "ggplot2")
# lognormal distribution
fit_lnorm <- fit.models(form, data = bc,
distr = "lognormal", method = "mle")
plot_transformed_km(fit_lnorm)
plot_transformed_km(fit_lnorm, graph = "ggplot2")
## for only one group
form <- formula("Surv(recyrs, censrec) ~ 1")
fit_exp <- fit.models(form, data = bc,
distr = "exp", method = "mle")
plot_transformed_km(fit_exp)
plot_transformed_km(fit_exp, graph = "ggplot2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.