MultiFrailty is a comprehensive R package designed for
shared frailty survival regression analysis. It unifies five frailty
distributions (Inverse Gaussian, Generalized Lindley Type 1, Generalized
Lindley Type 2, Gamma, and No-Frailty) across two flexible baseline
hazards (2-parameter Weibull and 3-parameter Generalized Weibull).
maxLik / optim with log-domain
numerical stability and analytical Laplace derivatives.survival::Surv(time, status) ~ x1 + x2 interface.# Install locally
install.packages("MultiFrailty", repos = NULL, type = "source")library(MultiFrailty)
# Generate synthetic survival data with GL Type 1 frailty & Weibull baseline
set.seed(123)
dat <- r_frailty(n = 100, baseline = "weibull", bpar = c(2, 1.5),
frailty = "gl1", fpar = c(1.2, 0.5),
x = matrix(rnorm(100), ncol = 1), beta = 0.5,
cen_type = "right", cen_rate = 0.1)
# Fit Shared Frailty Model via Formula Interface
fit <- multifrailty(Surv(time, status) ~ X1, data = dat,
baseline = "weibull", frailty = "gl1")
# Print Summary & Diagnostic Plots
summary(fit)
plot_all(fit)