Fits a parametric competing risks model assuming independent latent failure times, with each cause-specific baseline following the Beta-Danish distribution. Covariates may be included, entering each cause through an accelerated failure time link.
Usage
fit_bd_competing(
time,
cause,
covariates = NULL,
data = NULL,
submodel = FALSE,
n_starts = 5,
method = "BFGS"
)Arguments
- time
Numeric vector of observed times.
- cause
Integer vector of event causes: `0` for right-censored and `1, 2, ..., m` for the competing causes.
- covariates
Optional covariates. Either a one-sided formula such as `~ age + group`, evaluated in `data`, or a numeric matrix or data frame with one row per observation. `NULL` (default) fits cause-specific baselines with no regression structure.
- data
Data frame in which to evaluate `covariates` when it is a formula.
- submodel
Logical; if `TRUE`, fix `a = 1` in every cause, giving Exponentiated Danish cause-specific kernels. Default `FALSE`.
- n_starts
Integer; number of starting points for the joint optimisation.
- method
Optimisation method passed to [maxLik::maxLik()].
Details
Writing \(\delta_i\) for the observed cause and \(d_i\) for the event indicator, the log-likelihood is $$\ell = \sum_{i: d_i = 1}\Bigl[\log f_{\delta_i}(y_i) + \sum_{j \neq \delta_i}\log S_j(y_i)\Bigr] + \sum_{i: d_i = 0}\sum_{j=1}^{m}\log S_j(y_i).$$ An event contributes the log-density of its own cause and the log-survival of every other cause at the same time; a censored observation contributes the log-survival of every cause.
Covariates
Each cause carries its own coefficient vector \(\gamma_j\), acting on the time scale: $$T_j = T_{0j}\exp(x'\gamma_j),$$ so that a positive coefficient lengthens time to failure from that cause. The likelihood contribution of an event at \(t\) is evaluated at the accelerated time \(t\exp(-x'\gamma_j)\) with the Jacobian \(-x'\gamma_j\) added on the log scale.
The same design matrix is used for every cause, but the coefficients are free to differ, so a covariate may accelerate one cause and retard another. With `m` causes, `p` covariates and the full Beta-Danish kernel the model carries `m * (4 + p)` parameters, which grows quickly: check `summary()` for standard errors before interpreting any of them.
Identifiability of the cause-specific marginals
Mutual independence of the latent failure times is an *identifying* assumption, not an empirically testable property. Tsiatis (1975) showed that without it infinitely many joint distributions generate the same observable law of \((T, \delta)\), so the marginals cannot be recovered from the observed data alone.
Under positive latent dependence the working independence model overstates each cause-specific survival at moderate times, biasing the fitted cumulative incidence functions downward; negative dependence reverses both. The overall survival \(S(t) = \prod_j S_j(t)\) is more robust than the individual marginals. Where conclusions rest on absolute cause-specific CIFs rather than on model selection, supplement this fit with a copula-based sensitivity analysis.
References
Tsiatis, A. (1975). A nonidentifiability aspect of the problem of competing risks. *Proceedings of the National Academy of Sciences*, 72(1), 20-22. doi:10.1073/pnas.72.1.20
Examples
# \donttest{
# Without covariates
d <- simulate_bd_competing_data(150, seed = 1)
fit <- fit_bd_competing(d$time, d$cause, submodel = TRUE, n_starts = 1)
fit
#>
#> Call:
#> fit_bd_competing(time = d$time, cause = d$cause, submodel = TRUE,
#> n_starts = 1)
#>
#> Beta-Danish Competing Risks Model
#> Log-Likelihood: -442.9564
#>
#> Cause-specific estimates:
#> b c k
#> Cause_1 8.4374 2.0463 0.0216
#> Cause_2 1.4885 2.9280 0.1880
#>
# With one binary covariate. Note that simulate_bd_competing_data() only
# creates the covariate column when 'gammas' is supplied.
dx <- simulate_bd_competing_data(150, gammas = c(0.5, -0.5), seed = 2)
fit2 <- fit_bd_competing(dx$time, dx$cause, covariates = ~ x, data = dx,
submodel = TRUE, n_starts = 1)
fit2$coefficients
#> b c k gamma_x
#> Cause_1 1.445634 2.675880 0.12018233 0.3410904
#> Cause_2 1.960406 1.076946 0.03106741 -0.7030966
# }