| fit_betadanish | R Documentation |
Fits the Beta-Danish distribution using Maximum Likelihood Estimation (MLE). Supports both complete and right-censored data via 'survival::Surv' objects.
fit_betadanish(formula, data, submodel = FALSE, n_starts = 10, method = "BFGS")
formula |
A formula object, with the response on the left of a '~' operator, and the terms on the right. The response must be a survival object as returned by the 'Surv' function. Use '~ 1' for models without covariates. |
data |
A data frame containing the variables named in the formula. |
submodel |
Logical; if 'TRUE', fits the 3-parameter submodel by fixing 'a = 1'. |
n_starts |
Integer; the number of random starting points to use for the optimization to ensure global convergence. Default is 10. |
method |
Character; the optimization method passed to 'maxLik'. Default is "BFGS". |
The optimization is performed on the log-transformed parameters to strictly enforce positivity constraints. The returned coefficients and variance-covariance matrix are transformed back to the natural scale using the Delta method.
An object of S3 class '"betadanish"', containing the parameter estimates, log-likelihood, variance-covariance matrix, and convergence diagnostics.
# Simulate some data
set.seed(123)
sim_time <- rbetadanish(100, a = 1.5, b = 2, c = 3, k = 0.5)
sim_status <- sample(c(0, 1), 100, replace = TRUE, prob = c(0.2, 0.8))
dat <- data.frame(time = sim_time, status = sim_status)
# Fit the 4-parameter model
fit <- fit_betadanish(survival::Surv(time, status) ~ 1, data = dat)
summary(fit)
# Fit the 3-parameter submodel
fit_sub <- fit_betadanish(survival::Surv(time, status) ~ 1, data = dat, submodel = TRUE)
summary(fit_sub)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.