# Diagnostic Plot of Adequacy of Weibull Distribution

### Description

This function constructs a diagnostic plot of the adequacy of the Weibull distribution for survival data with respect to one categorical covariate. If the Weibull distribution fits the data well, then the lines produced should be linear and parallel.

### Usage

1 | ```
WeibullDiag(formula, data = parent.frame(), labels = rownames(np$X))
``` |

### Arguments

`formula` |
A formula containing a |

`data` |
Data set. |

`labels` |
A vector containing labels for the plotted lines. |

### Details

As discussed in Klein and Moeschberger (2003), one method for checking the adequacy of the Weibull model with a
categorical covariate is to produce stratified Kaplan-Meier estimates (KM), which can be transformed to estimate
the log cumulative hazard for each stratum. Then in a plot of *\log(t)* versus *\log(-\log(KM))*, the
lines should be linear and parallel. This can be seen as the log cumulative hazard for the Weibull distribution
is

*\log H(t) = \log λ + α \log t.*

### Value

Produces a plot of log Time vs. log Estimated Cumulative Hazard for each level of the predictor
(similarly to what can be obtained using `plot.survfit`

and the `fun = "cloglog"`

option),
as well as a data set containing that information.

### Author(s)

Sarah R. Haile

### References

Klein, J. and Moeschberger, M. (2003). *Survival analysis: techniques for censored and truncated data*.
Springer.

### See Also

Requires packages survival and prodlim. A similar plot can be produced using `plot.survfit`

and
the option `fun = "cloglog"`

.

### Examples

1 2 3 4 5 | ```
if (requireNamespace("prodlim")) {
data(larynx)
fm <- Surv(time, death) ~ stage
WeibullDiag(fm, larynx, labels=c("Stage I", "Stage II","Stage III", "Stage IV"))
}
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.