This vignette demonstrates a typical survival analysis workflow using the BetaDanish package.
library(BetaDanish)
library(survival)
#>
#> Attaching package: 'survival'
#> The following objects are masked from 'package:BetaDanish':
#>
#> leukemia, transplant
data('remission', package = 'BetaDanish')
head(remission)
#> time status
#> 1 0.08 1
#> 2 2.09 1
#> 3 3.48 1
#> 4 4.87 1
#> 5 6.94 1
#> 6 8.66 1fit <- fit_betadanish(Surv(time, status) ~ 1, data = remission, n_starts = 1)
summary(fit)
#>
#> Call:
#> fit_betadanish(formula = Surv(time, status) ~ 1, data = remission,
#> n_starts = 1)
#>
#> Beta-Danish Distribution Fit
#> Model: Full 4-Parameter Model
#>
#> Estimate Std. Error Lower 95% Upper 95% z value Pr(>|z|)
#> a 0.686576 0.961220 -1.197416 2.570568 0.7143 0.475057
#> b 4.078205 1.532792 1.073933 7.082476 2.6606 0.007799 **
#> c 2.196505 3.120622 -3.919914 8.312925 0.7039 0.481515
#> k 0.082973 0.090545 -0.094495 0.260441 0.9164 0.359470
#> ---
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> ---
#> Log-Likelihood: -409.9137
#> AIC: 827.8274 | BIC: 839.2356fit_sub <- fit_betadanish(Surv(time, status) ~ 1, data = remission, submodel = TRUE, n_starts = 1)
compare_models(fit, fit_sub)
#> Likelihood Ratio Test (a = 1 vs a != 1)
#>
#> Model LogLik Chisq Df Pr(>Chisq)
#> 1 Submodel (3-param) -409.9541 NA NA NA
#> 2 Full Model (4-param) -409.9137 0.08081129 1 0.776201The fitted model can be used to estimate survival probabilities, hazard behavior, and overall model fit. Users should compare the Beta-Danish model with alternative lifetime distributions and inspect diagnostic plots before drawing final conclusions.