| Title: | Shared Frailty Regression Models with Inverse Gaussian, Generalized Lindley, and Gamma Frailty Distributions |
|---|---|
| Description: | Implements shared frailty regression models for survival data under eight censoring mechanisms: exact, right censoring (Kalbfleisch and Prentice, 2002), left censoring, interval censoring (Sun, 2006), progressive Type I censoring, and progressive Type II censoring (Balakrishnan and Aggarwala, 2000 <doi:10.1007/978-1-4612-1334-5>). Combines four frailty distributions -- Gamma (Clayton, 1978), Inverse Gaussian (Hougaard, 1984), and two variants of the Generalized Lindley (GL) distribution: GL Type 1, a two-component gamma mixture with distribution-specific scale/shape linkage (Pandey, Hanagal, and Tyagi, 2022), and GL Type 2, a two-component gamma mixture with a common rate parameter (Pandey and Tyagi, 2021 <doi:10.1134/S1995080222010140>) -- with two baseline hazard distributions: the two-parameter Weibull distribution (Weibull, 1951) and the three-parameter Generalized (Exponentiated) Weibull distribution (Mudholkar and Srivastava, 1993 <doi:10.1109/24.229504>). A no-frailty baseline-only model is also supported for nested model comparison. Maximum likelihood estimation is conducted using Newton-Raphson and Broyden-Fletcher-Goldfarb-Shanno (BFGS) algorithms via the 'maxLik' package (Henningsen and Toomet, 2011 <doi:10.1007/s00180-010-0217-1>). Provides standard errors, confidence intervals, hypothesis tests, Akaike Information Criterion (AIC, Akaike, 1974 <doi:10.1109/TAC.1974.1100705>), Bayesian Information Criterion (BIC, Schwarz, 1978 <doi:10.1214/aos/1176344136>), corrected Akaike Information Criterion (AICc, Hurvich and Tsai, 1989), Hannan-Quinn Information Criterion (HQIC, Hannan and Quinn, 1979), a bootstrap approximation of the Widely Applicable Information Criterion (WAIC, Watanabe, 2010), k-fold cross-validation, frailty variance estimation, survival, hazard, median, risk, and marginal predictions, Cox-Snell (Cox and Snell, 1968), martingale (Barlow and Prentice, 1988), and deviance residuals with a Kolmogorov-Smirnov goodness-of-fit test, influence diagnostics (leverage, Cook's distance, difference in fits (DFFITS), difference in betas (DFBETAS); Belsley, Kuh, and Welsch, 1980), random data generation under all eight censoring mechanisms, a Monte Carlo simulation-study function, and a diagnostic and survival plotting suite. |
| Authors: | Shikhar Tyagi [aut, cre] (ORCID: <https://orcid.org/0000-0003-1606-0844>), Arvind Pandey [aut], Bhupendra Singh [aut], Vrijesh Tripathi [aut] |
| Maintainer: | Shikhar Tyagi <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-09-21 11:43:46 UTC |
| Source: | https://github.com/cran/MultiFrailty |
Computes baseline hazard phi0(t) and cumulative baseline hazard Phi0(t)
for Weibull and Generalized Weibull (GW) distributions.
baseline_hazard(t, baseline = c("weibull", "gw"), par)baseline_hazard(t, baseline = c("weibull", "gw"), par)
t |
Positive numeric vector of time points. |
baseline |
Character string specifying baseline distribution: |
par |
Numeric vector of parameters: |
A named list with components:
H0 |
Cumulative baseline hazard |
h0 |
Baseline hazard |
Mudholkar, G. S., & Srivastava, D. K. (1993). Exponentiated Weibull family for analyzing bathtub failure-rate data. IEEE Transactions on Reliability, 42(2), 299-302.
bh_weib <- baseline_hazard(1:5, baseline = "weibull", par = c(2, 1.5)) bh_gw <- baseline_hazard(1:5, baseline = "gw", par = c(0.5, 1.2, 1.1))bh_weib <- baseline_hazard(1:5, baseline = "weibull", par = c(2, 1.5)) bh_gw <- baseline_hazard(1:5, baseline = "gw", par = c(0.5, 1.2, 1.1))
Bootstrapped WAIC Computation
bootstrap_waic(fit, B = 200)bootstrap_waic(fit, B = 200)
fit |
Fitted |
B |
Number of bootstrap replications. Default is 200. |
Numeric value of bootstrapped WAIC.
Compares multiple fitted shared frailty models using AIC, BIC, AICc, HQIC, optional bootstrapped WAIC, and k-fold cross-validation.
compare_models( ..., criteria = c("AIC", "BIC", "AICc", "HQIC"), compute_waic = FALSE, waic_B = 100L )compare_models( ..., criteria = c("AIC", "BIC", "AICc", "HQIC"), compute_waic = FALSE, waic_B = 100L )
... |
Fitted |
criteria |
Character vector of selection criteria to include. |
compute_waic |
Logical; if TRUE computes bootstrapped WAIC. Default is FALSE. |
waic_B |
Number of bootstrap samples for WAIC. Default is 100. |
A data frame summarizing model comparisons ranked by AIC.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit1 <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "none") fit2 <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") cmp <- compare_models(fit1, fit2) print(cmp)set.seed(123) dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit1 <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "none") fit2 <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") cmp <- compare_models(fit1, fit2) print(cmp)
K-Fold Cross Validation for MultiFrailty Models
cv_frailty( time, status, x = matrix(nrow = length(time), ncol = 0), baseline = "weibull", frailty = "gamma", k = 5L, time2 = NULL )cv_frailty( time, status, x = matrix(nrow = length(time), ncol = 0), baseline = "weibull", frailty = "gamma", k = 5L, time2 = NULL )
time |
Time vector. |
status |
Status vector. |
x |
Covariate matrix. |
baseline |
Baseline distribution. |
frailty |
Frailty distribution. |
k |
Number of folds. Default is 5L. |
time2 |
Optional upper interval bound vector. |
Out-of-sample total log-likelihood score.
Diagnostic Summary Table
diagnostics_table(fit)diagnostics_table(fit)
fit |
Fitted |
Data frame of influence diagnostics.
Fits shared frailty regression models using Maximum Likelihood Estimation (MLE) across all 10 baseline-frailty combinations with robust optimizer fallbacks.
fit_frailty( time, status, x = matrix(nrow = length(time), ncol = 0), baseline = c("weibull", "gw"), frailty = c("none", "gamma", "ig", "gl1", "gl2"), time2 = NULL, prog_cen = NULL, init = NULL, method = "NR", ... )fit_frailty( time, status, x = matrix(nrow = length(time), ncol = 0), baseline = c("weibull", "gw"), frailty = c("none", "gamma", "ig", "gl1", "gl2"), time2 = NULL, prog_cen = NULL, init = NULL, method = "NR", ... )
time |
Primary survival/censoring time vector. |
status |
Event indicator vector (0 = right-censored, 1 = event, 2 = left-censored, 3 = interval-censored). |
x |
Design matrix of covariates (n x p). Default is a 0-column matrix. |
baseline |
Character string for baseline hazard: |
frailty |
Character string for frailty family: |
time2 |
Vector of upper interval bounds when |
prog_cen |
Vector of progressive censoring counts. Default is NULL. |
init |
Vector of initial values on the estimation scale. Default is NULL (automatic). |
method |
Optimization method passed to |
... |
Additional arguments passed to optimization algorithms. |
An object of class "multifrailty_fit" containing parameter estimates, standard errors,
information criteria, variance-covariance matrix, and diagnostic statistics.
Hougaard, P. (1984). Life table methods for heterogeneous populations: distributions of frailties. Biometrika, 71(1), 75-83.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) dat <- r_frailty(n = 100, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8), x = matrix(rnorm(100), ncol = 1), beta = 0.5) fit <- fit_frailty(time = dat$time, status = dat$status, x = as.matrix(dat[, "X1", drop=FALSE]), baseline = "weibull", frailty = "gamma") print(fit)set.seed(123) dat <- r_frailty(n = 100, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8), x = matrix(rnorm(100), ncol = 1), beta = 0.5) fit <- fit_frailty(time = dat$time, status = dat$status, x = as.matrix(dat[, "X1", drop=FALSE]), baseline = "weibull", frailty = "gamma") print(fit)
Future Survival Forecast
forecast_frailty(fit, horizon, n_grid = 200, newdata = NULL)forecast_frailty(fit, horizon, n_grid = 200, newdata = NULL)
fit |
Fitted |
horizon |
Forecast horizon time. |
n_grid |
Number of evaluation points. Default 200. |
newdata |
Optional new data frame. |
Matrix of forecasted survival probabilities.
Evaluates unconditional survival function S(t), probability density function f(t),
hazard function h(t), and cumulative hazard function H(t) for any specified
combination of frailty distribution and baseline hazard.
frailty_functions( t, eta = 1, frailty = c("none", "gamma", "ig", "gl1", "gl2"), fpar = numeric(0), baseline = c("weibull", "gw"), bpar )frailty_functions( t, eta = 1, frailty = c("none", "gamma", "ig", "gl1", "gl2"), fpar = numeric(0), baseline = c("weibull", "gw"), bpar )
t |
Positive numeric vector of time points. |
eta |
Linear predictor risk scores |
frailty |
Character string specifying frailty family: |
fpar |
Numeric vector of parameters for frailty distribution. |
baseline |
Character string specifying baseline hazard: |
bpar |
Numeric vector of parameters for baseline hazard. |
A named list containing:
S |
Unconditional survival probabilities |
f |
Unconditional density values |
h |
Unconditional hazard values |
H |
Unconditional cumulative hazard values |
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
gf <- frailty_functions(1:5, eta = 1, frailty = "gl1", fpar = c(2.13, 1.53), baseline = "gw", bpar = c(0.71, 2.13, 1.54))gf <- frailty_functions(1:5, eta = 1, frailty = "gl1", fpar = c(2.13, 1.53), baseline = "gw", bpar = c(0.71, 2.13, 1.54))
Computes Laplace transform L(s), first derivative L'(s),
and frailty variance Var(W) for five frailty families:
"none", "gamma", "ig", "gl1", and "gl2".
frailty_laplace( s, frailty = c("none", "gamma", "ig", "gl1", "gl2"), par = numeric(0) )frailty_laplace( s, frailty = c("none", "gamma", "ig", "gl1", "gl2"), par = numeric(0) )
s |
Non-negative numeric vector. |
frailty |
Character string specifying frailty family:
|
par |
Numeric vector of parameters per family:
|
A named list with components:
L |
Laplace transform L(s). |
L1 |
First derivative L'(s). |
Var |
Variance of frailty distribution Var(W), evaluated as L”(0) - 1. |
Hougaard, P. (1984). Life table methods for heterogeneous populations: distributions of frailties. Biometrika, 71(1), 75-83.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
fl_gamma <- frailty_laplace(s = 0.5, frailty = "gamma", par = c(0.8)) fl_gl1 <- frailty_laplace(s = 0.5, frailty = "gl1", par = c(1.2, 0.5)) fl_gl2 <- frailty_laplace(s = 0.5, frailty = "gl2", par = c(1.5, 0.8))fl_gamma <- frailty_laplace(s = 0.5, frailty = "gamma", par = c(0.8)) fl_gl1 <- frailty_laplace(s = 0.5, frailty = "gl1", par = c(1.2, 0.5)) fl_gl2 <- frailty_laplace(s = 0.5, frailty = "gl2", par = c(1.5, 0.8))
Computes leverage (hat values), Cook's distance, DFBETAS, and DFFITS for regression parameters.
influence_frailty(fit)influence_frailty(fit)
fit |
A fitted object of class |
A list containing leverage, Cook's distance, DFBETAS matrix, DFFITS vector, and a summary diagnostic table.
Belsley, D. A., Kuh, E., & Welsch, R. E. (1980). Regression diagnostics: Identifying influential data and sources of collinearity. John Wiley & Sons.
set.seed(123) dat <- r_frailty(n = 50, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") inf <- influence_frailty(fit) head(inf$diagnostics_table)set.seed(123) dat <- r_frailty(n = 50, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") inf <- influence_frailty(fit) head(inf$diagnostics_table)
Computes the log-likelihood for shared frailty models across all 10 baseline-frailty combinations with support for right, exact, left, and interval censoring, plus optional progressive censoring.
loglik_frailty( par_all, time, status, x = matrix(nrow = length(time), ncol = 0), baseline = c("weibull", "gw"), frailty = c("none", "gamma", "ig", "gl1", "gl2"), time2 = NULL, prog_cen = NULL )loglik_frailty( par_all, time, status, x = matrix(nrow = length(time), ncol = 0), baseline = c("weibull", "gw"), frailty = c("none", "gamma", "ig", "gl1", "gl2"), time2 = NULL, prog_cen = NULL )
par_all |
Vector of all model parameters on estimation scale (log/logit transformed). |
time |
Primary event/censoring time vector. |
status |
Event status vector (0 = right-censored, 1 = exact event, 2 = left-censored, 3 = interval-censored). |
x |
Matrix of covariates (n x p). Default is 0-column matrix. |
baseline |
Baseline hazard distribution ( |
frailty |
Frailty distribution ( |
time2 |
Vector of upper interval bounds when |
prog_cen |
Vector of progressive censoring counts R_i per observation. Default is NULL. |
Scalar log-likelihood value. Returns -1e12 sentinel on numerical invalidity.
par_all <- c(log(2), log(1.5), log(0.8), 0.1) # Weibull + Gamma + 1 beta time <- c(1, 2, 3, 4) status <- c(1, 0, 1, 0) x <- matrix(c(0.5, -0.2, 0.1, 0.8), ncol = 1) ll <- loglik_frailty(par_all, time, status, x, baseline = "weibull", frailty = "gamma")par_all <- c(log(2), log(1.5), log(0.8), 0.1) # Weibull + Gamma + 1 beta time <- c(1, 2, 3, 4) status <- c(1, 0, 1, 0) x <- matrix(c(0.5, -0.2, 0.1, 0.8), ncol = 1) ll <- loglik_frailty(par_all, time, status, x, baseline = "weibull", frailty = "gamma")
Fits shared frailty regression models using a formula specifying survival response
(e.g., survival::Surv(time, status) ~ x1 + x2) and data frame.
multifrailty( formula, data, baseline = c("weibull", "gw"), frailty = c("none", "gamma", "ig", "gl1", "gl2"), method = "NR", ... )multifrailty( formula, data, baseline = c("weibull", "gw"), frailty = c("none", "gamma", "ig", "gl1", "gl2"), method = "NR", ... )
formula |
Model formula of the form |
data |
Data frame containing variables in |
baseline |
Character string specifying baseline hazard: |
frailty |
Character string specifying frailty family: |
method |
Optimization method for |
... |
Additional arguments passed to |
Object of class c("multifrailty", "multifrailty_fit").
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) df <- data.frame( time = stats::rexp(50, rate = 0.1), status = sample(c(0, 1), 50, replace = TRUE), age = stats::rnorm(50, mean = 50, sd = 10), sex = sample(c(0, 1), 50, replace = TRUE) ) fit <- multifrailty(survival::Surv(time, status) ~ age + sex, data = df, baseline = "weibull", frailty = "gamma") print(fit)set.seed(123) df <- data.frame( time = stats::rexp(50, rate = 0.1), status = sample(c(0, 1), 50, replace = TRUE), age = stats::rnorm(50, mean = 50, sd = 10), sex = sample(c(0, 1), 50, replace = TRUE) ) fit <- multifrailty(survival::Surv(time, status) ~ age + sex, data = df, baseline = "weibull", frailty = "gamma") print(fit)
Displays comprehensive multi-panel diagnostic plot suite.
plot_all(fit, ask = grDevices::dev.interactive(), save_to_file = NULL)plot_all(fit, ask = grDevices::dev.interactive(), save_to_file = NULL)
fit |
Fitted model. |
ask |
Logical; if TRUE prompts user. |
save_to_file |
Optional file path to save plot grid. |
No return value, called for side effects (displays a 2x3 grid of diagnostic plots or saves them to a file).
Baseline Hazard Plot
plot_baseline( baseline = c("weibull", "gw"), par, t_range = c(0.01, 3), n_grid = 300 )plot_baseline( baseline = c("weibull", "gw"), par, t_range = c(0.01, 3), n_grid = 300 )
baseline |
Baseline distribution. |
par |
Baseline parameters. |
t_range |
Time range vector. |
n_grid |
Grid resolution. |
No return value, called for side effects (displays baseline hazard and cumulative baseline hazard plots).
Coefficient Forest Plot
plot_coef_forest(fit)plot_coef_forest(fit)
fit |
Fitted model. |
No return value, called for side effects (displays a forest plot of parameter estimates with 95% confidence intervals).
DFBETAS Plot
plot_dfbetas(fit)plot_dfbetas(fit)
fit |
Fitted model. |
No return value, called for side effects (displays boxplots of DFBETAS values across parameters).
Frailty Density Overlay Plot across Families
plot_frailty_density(t_max = 3)plot_frailty_density(t_max = 3)
t_max |
Maximum grid value. |
No return value, called for side effects (displays frailty density overlay curves across distributions).
Leverage Index Plot
plot_leverage(fit)plot_leverage(fit)
fit |
Fitted model. |
No return value, called for side effects (displays an index plot of observation leverage values).
Q-Q Plot of Cox-Snell Residuals vs Exp(1)
plot_qq_residuals(fit)plot_qq_residuals(fit)
fit |
Fitted model. |
No return value, called for side effects (displays a Q-Q plot of Cox-Snell residuals versus standard exponential distribution).
Residuals vs Fitted Plot
plot_residuals_fitted(fit)plot_residuals_fitted(fit)
fit |
Fitted model. |
No return value, called for side effects (displays a plot of martingale residuals against fitted survival probabilities).
Residuals vs Leverage Plot
plot_residuals_leverage(fit)plot_residuals_leverage(fit)
fit |
Fitted model. |
No return value, called for side effects (displays a plot of standardized residuals against leverage values).
Scale-Location Plot
plot_scale_location(fit)plot_scale_location(fit)
fit |
Fitted model. |
No return value, called for side effects (displays a scale-location plot of square-root absolute standardized residuals against fitted survival probabilities).
Provides specialized plotting capabilities for fitted shared frailty models, including frailty density overlays across all five families, baseline hazard curves, Kaplan-Meier survival curves, residual diagnostic plots, coefficient forest plots, and influence diagnostic plots.
plot_survival_km(fit)plot_survival_km(fit)
fit |
A fitted object of class |
No return value, called for side effects (displays a Kaplan-Meier survival curve with fitted MultiFrailty model overlay).
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") plot_survival_km(fit)set.seed(123) dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") plot_survival_km(fit)
Computes survival probabilities, hazard rates, median survival times, expected survival times,
risk scores, marginal survival curves, or future survival forecasts for a fitted multifrailty model.
predict_frailty( fit, newdata = NULL, newtime = NULL, type = c("survival", "hazard", "median", "expected", "risk", "marginal", "forecast"), window = NULL )predict_frailty( fit, newdata = NULL, newtime = NULL, type = c("survival", "hazard", "median", "expected", "risk", "marginal", "forecast"), window = NULL )
fit |
A fitted object of class |
newdata |
Optional data frame of new covariate values. If NULL, uses training data. |
newtime |
Optional vector of evaluation time points. If NULL, uses default grid. |
type |
Type of prediction: |
window |
Optional forecast window or horizon parameter. |
Vector or matrix of predictions depending on type.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") pred_surv <- predict_frailty(fit, type = "survival", newtime = c(1, 2, 3))set.seed(123) dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") pred_surv <- predict_frailty(fit, type = "survival", newtime = c(1, 2, 3))
Provides standard print, summary, coef, vcov,
logLik, AIC, BIC, and confint S3 methods for objects
of class "multifrailty_fit".
## S3 method for class 'multifrailty_fit' print(x, ...) ## S3 method for class 'multifrailty_fit' summary(object, ...) ## S3 method for class 'summary.multifrailty_fit' print(x, ...) ## S3 method for class 'multifrailty_fit' coef(object, ...) ## S3 method for class 'multifrailty_fit' vcov(object, ...) ## S3 method for class 'multifrailty_fit' logLik(object, ...) ## S3 method for class 'multifrailty_fit' AIC(object, ...) ## S3 method for class 'multifrailty_fit' BIC(object, ...) ## S3 method for class 'multifrailty_fit' confint(object, parm, level = 0.95, ...)## S3 method for class 'multifrailty_fit' print(x, ...) ## S3 method for class 'multifrailty_fit' summary(object, ...) ## S3 method for class 'summary.multifrailty_fit' print(x, ...) ## S3 method for class 'multifrailty_fit' coef(object, ...) ## S3 method for class 'multifrailty_fit' vcov(object, ...) ## S3 method for class 'multifrailty_fit' logLik(object, ...) ## S3 method for class 'multifrailty_fit' AIC(object, ...) ## S3 method for class 'multifrailty_fit' BIC(object, ...) ## S3 method for class 'multifrailty_fit' confint(object, parm, level = 0.95, ...)
x |
An object of class |
... |
Additional arguments. |
object |
An object of class |
parm |
Optional parameter vector or names. |
level |
Confidence level for interval. Default 0.95. |
Formatted console output or numeric objects depending on method.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
Generates survival times and censoring indicators for shared frailty regression models across all 10 baseline-frailty combinations under eight distinct censoring mechanisms.
r_frailty( n, baseline = c("weibull", "gw"), bpar, frailty = c("none", "gamma", "ig", "gl1", "gl2"), fpar = numeric(0), x = matrix(nrow = n, ncol = 0), beta = numeric(0), cen_type = c("none", "right", "left", "interval", "type1", "type2", "progressive", "progressive_type1"), cen_rate = 0.2, left_threshold = NULL, int_width = NULL, cen_time = NULL, r_failures = NULL, prog_scheme = NULL, prog_times = NULL )r_frailty( n, baseline = c("weibull", "gw"), bpar, frailty = c("none", "gamma", "ig", "gl1", "gl2"), fpar = numeric(0), x = matrix(nrow = n, ncol = 0), beta = numeric(0), cen_type = c("none", "right", "left", "interval", "type1", "type2", "progressive", "progressive_type1"), cen_rate = 0.2, left_threshold = NULL, int_width = NULL, cen_time = NULL, r_failures = NULL, prog_scheme = NULL, prog_times = NULL )
n |
Number of observations to generate. |
baseline |
Baseline hazard distribution ( |
bpar |
Baseline parameter vector. |
frailty |
Frailty distribution ( |
fpar |
Frailty parameter vector. |
x |
Matrix of covariates (n x p). Default is 0-column matrix. |
beta |
Regression coefficient vector matching columns of |
cen_type |
Censoring mechanism: |
cen_rate |
Exponential rate for right-censoring time generation. Default is 0.2. |
left_threshold |
Threshold for left censoring. Default is 20th percentile. |
int_width |
Width of censoring window for interval censoring. Default is 20% of mean time. |
cen_time |
Fixed cutoff time for Type-I censoring. Default is 70th percentile. |
r_failures |
Target number of failures for Type-II censoring. Default is |
prog_scheme |
Vector of progressive removal counts for progressive censoring. |
prog_times |
Inspection time points for progressive Type-I censoring. |
A data frame containing generated time, time2 (for interval), status, and covariates.
Hougaard, P. (1984). Life table methods for heterogeneous populations: distributions of frailties. Biometrika, 71(1), 75-83.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) dat <- r_frailty(n = 100, baseline = "weibull", bpar = c(2, 1.5), frailty = "gl1", fpar = c(1.2, 0.5), cen_type = "right", cen_rate = 0.1) head(dat)set.seed(123) dat <- r_frailty(n = 100, baseline = "weibull", bpar = c(2, 1.5), frailty = "gl1", fpar = c(1.2, 0.5), cen_type = "right", cen_rate = 0.1) head(dat)
Generates random variates from GL Type 1 frailty distribution (two-component Gamma mixture).
r_gl1(n, eta, epsilon)r_gl1(n, eta, epsilon)
n |
Number of observations to generate. |
eta |
Parameter eta > 0. |
epsilon |
Parameter epsilon > 0. |
Numeric vector of length n.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
set.seed(123) w_gl1 <- r_gl1(100, eta = 1.2, epsilon = 0.5)set.seed(123) w_gl1 <- r_gl1(100, eta = 1.2, epsilon = 0.5)
Generates random variates from GL Type 2 frailty distribution (two-component Gamma mixture with common rate).
r_gl2(n, theta, mu)r_gl2(n, theta, mu)
n |
Number of observations to generate. |
theta |
Parameter theta > 0. |
mu |
Parameter mu in (0, 1 + theta). |
Numeric vector of length n.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) w_gl2 <- r_gl2(100, theta = 1.5, mu = 0.8)set.seed(123) w_gl2 <- r_gl2(100, theta = 1.5, mu = 0.8)
Generates random variates from the 3-parameter Generalized Weibull baseline distribution.
r_gw(n, delta, zeta, xi)r_gw(n, delta, zeta, xi)
n |
Number of observations to generate. |
delta |
Scale parameter (delta > 0). |
zeta |
Shape parameter (zeta > 0). |
xi |
Shape parameter (xi > 0). |
Numeric vector of length n containing random samples.
Mudholkar, G. S., & Srivastava, D. K. (1993). Exponentiated Weibull family for analyzing bathtub failure-rate data. IEEE Transactions on Reliability, 42(2), 299-302.
set.seed(123) sim_data <- r_gw(100, delta = 0.5, zeta = 1.2, xi = 1.1)set.seed(123) sim_data <- r_gw(100, delta = 0.5, zeta = 1.2, xi = 1.1)
Generates random variates from the Inverse Gaussian frailty distribution with mean E[W] = 1.
r_ig(n, eta)r_ig(n, eta)
n |
Number of observations to generate. |
eta |
Frailty variance parameter (eta > 0). |
Numeric vector of length n.
Hougaard, P. (1984). Life table methods for heterogeneous populations: distributions of frailties. Biometrika, 71(1), 75-83.
set.seed(123) w_ig <- r_ig(100, eta = 0.5)set.seed(123) w_ig <- r_ig(100, eta = 0.5)
Computes Cox-Snell, Martingale, Deviance, raw, standardized, and studentized residuals along with Kolmogorov-Smirnov (K-S) goodness-of-fit statistics against standard Exponential(1).
residuals_frailty(fit)residuals_frailty(fit)
fit |
A fitted object of class |
A list containing residual vectors, summary accuracy metrics (MSE, RMSE, MAE, R_square, Adj_R_square),
and K-S test results (KS_stat, KS_pvalue).
Cox, D. R., & Snell, E. J. (1968). A general definition of residuals. Journal of the Royal Statistical Society: Series B (Methodological), 30(2), 248-265.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") res <- residuals_frailty(fit) print(res$KS_pvalue)set.seed(123) dat <- r_frailty(n = 60, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) fit <- fit_frailty(time = dat$time, status = dat$status, baseline = "weibull", frailty = "gamma") res <- residuals_frailty(fit) print(res$KS_pvalue)
Risk Score Predictions
risk_predict(fit, newdata, times = NULL)risk_predict(fit, newdata, times = NULL)
fit |
Fitted |
newdata |
Data frame of new observations. |
times |
Optional time grid. |
Numeric vector of risk scores exp(X %*% beta).
Evaluates frequentist Maximum Likelihood Estimation performance (bias, relative bias, MSE, empirical coverage) across repeated Monte Carlo replications under user-specified baseline, frailty, and censoring schemes.
simulate_mle_performance( n_sim = 50, n = 100, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8), beta = 0.5, cen_type = "right", cen_rate = 0.2 )simulate_mle_performance( n_sim = 50, n = 100, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8), beta = 0.5, cen_type = "right", cen_rate = 0.2 )
n_sim |
Number of Monte Carlo simulation replicates. Default is 50. |
n |
Sample size per replicate. Default is 100. |
baseline |
Character string for baseline hazard ( |
bpar |
True baseline parameter vector. |
frailty |
Character string for frailty family ( |
fpar |
True frailty parameter vector. |
beta |
True regression parameter. Default 0.5. |
cen_type |
Censoring mechanism. Default |
cen_rate |
Censoring rate. Default 0.2. |
A data frame summarizing parameter true values, mean estimates, bias, relative bias, MSE, and coverage.
Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.
Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.
set.seed(123) sim_res <- simulate_mle_performance(n_sim = 10, n = 50, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) print(sim_res)set.seed(123) sim_res <- simulate_mle_performance(n_sim = 10, n = 50, baseline = "weibull", bpar = c(2, 1.5), frailty = "gamma", fpar = c(0.8)) print(sim_res)
Run Comprehensive Simulation Study
simulation_study( sample_sizes = c(25, 50, 100), n_sim = 20, baseline = "weibull", frailty = "gl2" )simulation_study( sample_sizes = c(25, 50, 100), n_sim = 20, baseline = "weibull", frailty = "gl2" )
sample_sizes |
Vector of sample sizes. Default c(25, 50, 100). |
n_sim |
Number of simulation replicates per setting. Default 20. |
baseline |
Baseline hazard. Default |
frailty |
Frailty distribution. Default |
Master data frame of Monte Carlo simulation metrics across sample sizes.
Survival Probability at Specific Time Points
survival_at(fit, times, newdata = NULL)survival_at(fit, times, newdata = NULL)
fit |
Fitted |
times |
Vector of target time points. |
newdata |
Optional new data frame. |
Matrix of survival probabilities.