test_distributions() refits a generalized gamma aft() model with each distribution it
nests, using the same covariates and weights, and tests each against it with a likelihood ratio
test. The Weibull is the generalized gamma with \(Q = 1\), and the log-normal its limit as
\(Q \to 0\), so each has one parameter fewer. The exponential also fixes \(\sigma = 1\), so
it has two fewer. A small p-value says the simpler distribution fits worse than the generalized
gamma. The log-logistic isn't nested in the generalized gamma, so it isn't tested here (compare
it by AIC instead).
Arguments
- fit
An
aft()fit withdist = "gengamma".
Value
A data frame with one row per nested distribution ("weibull", "lognormal", and
"exponential"): dist, loglik and aic of its fit, and the likelihood ratio test against
the generalized gamma, lr_statistic, df, and p_value.
Examples
lung <- data.frame(
time = c(306, 455, 1010, 210, 883, 1022, 310, 361, 218, 166, 170, 654, 728, 71, 567),
status = c(2, 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2),
age = c(74, 68, 56, 57, 60, 74, 68, 71, 53, 61, 57, 68, 68, 60, 57)
)
fit <- aft(Surv(time, status) ~ age, data = lung, dist = "gengamma")
test_distributions(fit)
#> dist loglik aic lr_statistic df p_value
#> 1 weibull -93.90000 193.8000 2.7085549 1 0.09981137
#> 2 lognormal -92.76151 191.5230 0.4315819 1 0.51121375
#> 3 exponential -94.80067 193.6013 4.5099007 2 0.10487875