| Title: | Shared, Correlated, Additive, and Zero-Inflated Frailty Models |
|---|---|
| Description: | Fits and compares shared, correlated, additive, zero-inflated promotion cure-rate, and k-out-of-M one-shot device frailty survival models under Bayesian Markov chain Monte Carlo (MCMC) and Maximum Likelihood Estimation (MLE) frameworks. Supports ten baseline hazard distributions (Weibull, Exponential, Generalized Exponential, Exponential Power, Linear Failure Rate, Generalized Log-Logistic, Generalized Weibull, Generalized Rayleigh, Weighted Exponential, Extended Weibull) and eight frailty distributions (Gamma, Inverse Gaussian, Positive Stable, Compound Poisson, Compound Negative Binomial, Generalized Lindley, Weighted Lindley, Mixture of Inverse Gaussians). Implements reversed hazard rate (RHR) models for bivariate left-censored survival data, additive shared frailty models under random right censoring, and one-shot device reliability analysis. Provides goodness-of-fit testing, information criteria (AIC, BIC, AICc, HQIC, DIC, EAIC, EBIC, LPML), convergence diagnostics (Geweke, Gelman-Rubin, Heidelberger-Welch), Bayes factors, residual analyses, and diagnostic visualizations. Methodologies are based on Hanagal and Dabade (2013) <doi:10.1016/j.spl.2013.07.015>, Hanagal and Dabade (2013) <doi:10.1080/03610918.2012.661909>, Hanagal and Dabade (2015) <doi:10.1080/03610926.2013.804561>, Hanagal and Bhambure (2015) <doi:10.3233/MAS-140308>, Hanagal and Bhambure (2016) <doi:10.1080/03610926.2014.901380>, Hanagal, Pandey, and Ganguly (2017) <doi:10.1080/03610918.2015.1085559>, Hanagal and Pandey (2018) <doi:10.1080/03610926.2018.1549256>, Hanagal (2020) <doi:10.1080/03610926.2020.1736305>, Tyagi et al. (2021) <doi:10.1007/s40314-021-01666-5>, Pandey, Hanagal, Tyagi, and Gupta (2021) <doi:10.1142/S0218539321500406>, Tyagi, Pandey, and Chesneau (2022) <doi:10.1007/s42519-021-00241-9>, Pandey, Hanagal, and Tyagi (2022) <doi:10.2478/stattrans-2022-0048>, Tyagi, Pandey, and Chesneau (2022) <doi:10.1007/s13571-022-00278-1>, Tyagi, Pandey, Hanagal, and Chesneau (2024) <doi:10.1080/03610918.2024.2391874>, Kiprotich et al. (2025) <doi:10.1080/02664763.2025.2560510>, Assuncao et al. (2026) <doi:10.1002/bimj.70162>, Chen et al. (1999) <doi:10.1080/01621459.1999.10474198>, Dunn and Smyth (1996) <doi:10.1080/10618600.1996.10474708>, Ling et al. (2021) <doi:10.3390/math9233032>, Yu, So, and Balakrishnan (2025) <doi:10.1016/B978-0-44-331694-4.00006-2>, Balakrishnan, Ling, and So (2021, ISBN:978-1-119-77795-3), and McGilchrist and Aisbett (1991) <doi:10.2307/2532138>. |
| Authors: | Shikhar Tyagi [aut, cre] (ORCID: <https://orcid.org/0000-0003-1606-0844>) |
| Maintainer: | Shikhar Tyagi <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-10-27 20:21:05 UTC |
| Source: | https://github.com/cran/FrailtyPackPlus |
Bivariate survival dataset containing ages at onset of appendectomy in 350 male twin pairs from the Australian Twin Registry, with left-censoring.
austrian_twinaustrian_twin
A data frame with 350 rows and 7 variables:
Age at onset of appendectomy (in years) for twin 1 (lifetime).
Age at onset of appendectomy (in years) for twin 2 (lifetime).
Censoring indicator for twin 1 (1 = observed, 0 = left-censored).
Censoring indicator for twin 2 (1 = observed, 0 = left-censored).
Age of the twin pair (covariate K1).
Binary indicator of appendectomy condition for twin 1 (covariate K2).
Binary indicator of appendectomy condition for twin 2 (covariate K3).
Duffy, D. L., Martin, N. G., & Mathews, J. D. (1990). Appendectomy in Australian twins. American Journal of Human Genetics, 47(3), 590-592.
Tyagi, S., Pandey, A., & Chesneau, C. (2022). Identifying the effects of observed and unobserved risk factors using weighted Lindley shared regression model. Journal of Statistical Theory and Practice, 16(1), 16. doi:10.1007/s42519-021-00241-9.
Tyagi, S., Pandey, A., & Chesneau, C. (2022). Weighted Lindley shared regression model for bivariate left censored data. Sankhya B: The Indian Journal of Statistics, 84(2), 754-784. doi:10.1007/s13571-022-00278-1.
Pandey, A., Hanagal, D. D., Gupta, P., & Tyagi, S. (2020). Analysis of Australian twin data using generalized inverse Gaussian shared frailty models based on reversed hazard rate. International Journal of Statistics and Reliability Engineering, 7(2), 219-235.
Pandey, A., Hanagal, D. D., Tyagi, S., & Gupta, P. (2021). Generalized Lindley shared frailty based on reversed hazard rate. International Journal of Reliability, Quality and Safety Engineering, 28(5), 2150040. doi:10.1142/S0218539321500406.
Gupta, P., Pandey, A., & Tyagi, S. (2022). Comparison of multiplicative frailty models under generalized log-logistic-II baseline distribution for counter heterogeneous left censored data. In Statistical Techniques for Interdisciplinary Research (pp. 97-108). ISBN: 978-93-91248-57-4.
data(austrian_twin) summary(austrian_twin)data(austrian_twin) summary(austrian_twin)
Computes the cumulative baseline hazard for Weibull, Gompertz,
or Exponential baseline distributions.
base_cumhaz( t, shape, scale, baseline = c("weibull", "gompertz", "exponential") )base_cumhaz( t, shape, scale, baseline = c("weibull", "gompertz", "exponential") )
t |
Numeric vector of positive survival times. |
shape |
Numeric vector or scalar representing baseline shape parameter(s) (> 0). |
scale |
Numeric vector or scalar representing baseline scale parameter(s) (> 0). |
baseline |
Character string indicating the baseline hazard distribution:
|
Numeric vector of cumulative baseline hazard values.
Computes the baseline hazard rate for Weibull, Gompertz,
or Exponential baseline distributions.
base_haz(t, shape, scale, baseline = c("weibull", "gompertz", "exponential"))base_haz(t, shape, scale, baseline = c("weibull", "gompertz", "exponential"))
t |
Numeric vector of positive survival times. |
shape |
Numeric vector or scalar representing baseline shape parameter(s) (> 0). |
scale |
Numeric vector or scalar representing baseline scale parameter(s) (> 0). |
baseline |
Character string indicating the baseline hazard distribution:
|
Numeric vector of baseline hazard rate values.
Computes the Bayes factor comparing Model 1 against Model 2 using the ratio of Pseudo Marginal Likelihoods (LPML) or harmonic mean marginal likelihood.
bayes_factor(model1, model2)bayes_factor(model1, model2)
model1 |
Fitted object of class |
model2 |
Fitted object of class |
A list containing BF12 (Bayes Factor), log_BF12,
and verbal interpretation according to Jeffreys' scale.
data(kidney_frailty) m1 <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, frailty = "gamma", n_iter = 200, burn_in = 50) m2 <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, frailty = "invgauss", n_iter = 200, burn_in = 50) bayes_factor(m1, m2)data(kidney_frailty) m1 <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, frailty = "gamma", n_iter = 200, burn_in = 50) m2 <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, frailty = "invgauss", n_iter = 200, burn_in = 50) bayes_factor(m1, m2)
Computes the Bayes factor comparing two Bayesian shared RHR frailty models based on log pseudo-marginal likelihoods (LPML) or marginal deviances:
bayes_factor_rhr(model1, model2)bayes_factor_rhr(model1, model2)
model1 |
Fitted object of class |
model2 |
Fitted object of class |
Evaluates the strength of evidence between two Bayesian models using the scale of Kass and Raftery (1995)
based on .
A list containing the following components:
log_BF12Natural logarithm of the Bayes factor .
BF12Bayes factor value .
two_log_BF12Twice the natural logarithm of the Bayes factor .
LPML_Model1Log pseudo-marginal likelihood of Model 1.
LPML_Model2Log pseudo-marginal likelihood of Model 2.
EvidenceVerbal interpretation of evidence according to the Kass and Raftery (1995) scale.
data(austrian_twin) fit1 <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "GE", n_iter = 40, burn_in = 10) fit2 <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "EG", n_iter = 40, burn_in = 10) bayes_factor_rhr(fit1, fit2)data(austrian_twin) fit1 <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "GE", n_iter = 40, burn_in = 10) fit2 <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "EG", n_iter = 40, burn_in = 10) bayes_factor_rhr(fit1, fit2)
Computes Bayes point estimates and corresponding posterior risks under Squared Error Loss Function (SELF), Modified Quadratic Squared Error Loss Function (MQSELF), and Precautionary Loss Function (PLF), along with equal-tailed Bayesian Credible Intervals and Highest Posterior Density (HPD) bounds.
calc_loss_estimates(samples, level = 0.95)calc_loss_estimates(samples, level = 0.95)
samples |
Matrix or data frame of MCMC posterior draws (rows = iterations, columns = parameters). |
level |
Confidence level for credible intervals (default is 0.95). |
A data frame containing:
Parameter name.
Bayes estimate under SELF (posterior mean).
Posterior risk under SELF (posterior variance).
Bayes estimate under MQSELF.
Posterior risk under MQSELF.
Bayes estimate under PLF.
Posterior risk under PLF.
Lower bound of equal-tailed credible interval.
Upper bound of equal-tailed credible interval.
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
Norstrom, J. G. (1996). The use of precautionary loss functions in risk analysis. IEEE Transactions on Reliability, 45(3), 400-403. doi:10.1109/24.536992
# Simulated posterior samples set.seed(123) post_draws <- matrix(rgamma(1000 * 3, shape = 4, rate = 2), ncol = 3) colnames(post_draws) <- c("zeta1", "delta1", "xi1") calc_loss_estimates(post_draws)# Simulated posterior samples set.seed(123) post_draws <- matrix(rgamma(1000 * 3, shape = 4, rate = 2), ncol = 3) colnames(post_draws) <- c("zeta1", "delta1", "xi1") calc_loss_estimates(post_draws)
The modified Class-H failure modes data presented in Table 10 of Ling et al. (2021),
adapted from motorette insulation testing originally reported by Nelson (2009).
The dataset records the outcomes of one-shot inspections across 8 test groups
under four elevated temperature conditions with failure modes:
Turn failure (T) and Ground failure (G).
classHclassH
A data frame with 8 rows and 7 variables:
groupTest group index ().
stressAccelerated temperature stress level in degrees Fahrenheit ().
timePre-specified inspection time in hours ().
n_noneNumber of functioning devices (neither component malfunctioned, ).
n_TNumber of devices with only Turn component failure ().
n_GNumber of devices with only Ground component failure ().
n_bothNumber of devices with both Turn and Ground failures ().
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
Nelson, W. B. (2009). Accelerated Testing: Statistical Models, Test Plans, and Data Analysis. John Wiley & Sons, Hoboken, NJ.
data(classH) head(classH)data(classH) head(classH)
Extracts estimated parameters from a fitted "oneshot_kofm" object.
## S3 method for class 'oneshot_kofm' coef(object, ...)## S3 method for class 'oneshot_kofm' coef(object, ...)
object |
A fitted model object of class |
... |
Additional arguments. |
A named numeric vector of parameter estimates.
Tabulates and compares multiple fitted Bayesian or MLE shared frailty models using information criteria (AIC, BIC, AICc, HQIC, DIC, LPML), Kendall's tau, and frailty variance.
compare_rhr_models(..., models_list = NULL)compare_rhr_models(..., models_list = NULL)
... |
Fitted objects of class |
models_list |
Optional list of fitted model objects. |
Compares goodness-of-fit and penalized likelihood criteria across competing models. Models with lower AIC, BIC, AICc, HQIC, and DIC, and higher LPML (closer to zero) represent superior fits.
A data frame with one row per model containing:
ModelName or label of the model.
FrailtyFrailty distribution.
BaselineBaseline distribution.
MethodEstimation methodology ("Bayes" or "MLE").
LogLikLog-likelihood at parameter point estimates.
AICAkaike Information Criterion.
BICBayesian Information Criterion.
AICcCorrected Akaike Information Criterion.
HQICHannan-Quinn Information Criterion.
DICDeviance Information Criterion (for Bayesian fits).
LPMLLog Pseudo Marginal Likelihood (for Bayesian fits).
Kendall_TauEstimated Kendall's tau rank correlation.
Frailty_VarEstimated theoretical variance of the frailty variable.
data(austrian_twin) fit1 <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "GE", n_iter = 40, burn_in = 10) fit2 <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "EG", n_iter = 40, burn_in = 10) compare_rhr_models(WL_GE = fit1, WL_EG = fit2)data(austrian_twin) fit1 <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "GE", n_iter = 40, burn_in = 10) fit2 <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "EG", n_iter = 40, burn_in = 10) compare_rhr_models(WL_GE = fit1, WL_EG = fit2)
Calculates the expected mean failure times and moments for individual components under gamma frailty.
component_moments(object, ...)component_moments(object, ...)
object |
A fitted model object of class |
... |
Additional arguments passed to methods. |
A data frame or list containing component mean lifetimes and standard deviations.
Computes the marginal scale, shape, mean lifetime, variance, and standard deviation for individual components under the Power Lomax marginal distribution.
## S3 method for class 'oneshot_frailty' component_moments(object, stress = NULL, ...)## S3 method for class 'oneshot_frailty' component_moments(object, stress = NULL, ...)
object |
A fitted model object of class |
stress |
Optional numeric vector or matrix of stress covariate values. |
... |
Additional arguments passed to other methods. |
Under Weibull baseline lifetime and shared gamma frailty with variance ,
the marginal unconditional lifetime distribution of component is Power Lomax
with survival function
The -th raw moment is given in closed form by:
valid when .
A data frame containing:
Component name.
Estimated scale parameter .
Estimated shape parameter .
Frailty variance parameter .
Marginal mean lifetime (or Inf if ).
Marginal variance (or Inf if ).
Marginal standard deviation.
Yu, C., So, H. Y., and Balakrishnan, N. (2025). Inference for one-shot devices with Weibull component lifetimes under gamma frailty model. In: Stochastic Modeling and Statistical Methods, Elsevier Inc., Chapter 1, pp. 1–34. doi:10.1016/B978-0-44-331694-4.00006-2.
data(classH) start_par <- c(-3.997, -0.009, -14.412, 0.003, 0.004, -0.001, -5.493e-4, -0.005, 0.082) fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE, start = start_par ) component_moments(fit_w, stress = 400)data(classH) start_par <- c(-3.997, -0.009, -14.412, 0.003, 0.004, -0.001, -5.493e-4, -0.005, 0.082) fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE, start = start_par ) component_moments(fit_w, stress = 400)
Computes the marginal scale, mean, and variance for each failure mode under Lomax / Exponential distributions with gamma frailty.
## S3 method for class 'oneshot_kofm' component_moments(object, stress, ...)## S3 method for class 'oneshot_kofm' component_moments(object, stress, ...)
object |
A fitted model object of class |
stress |
A numeric scalar or vector representing operating conditions. |
... |
Additional arguments passed to other methods. |
Under gamma frailty, the marginal distribution of component is Lomax
(Pareto Type II) with:
Missing values are not permitted.
A data frame containing:
Component name.
Operating stress level.
Estimated scale parameter .
Marginal mean lifetime .
Marginal lifetime variance (if ).
Marginal standard deviation.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
data(classH) fit <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "exponential" ) component_moments(fit, stress = 356)data(classH) fit <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "exponential" ) component_moments(fit, stress = 356)
Computes Geweke z-score, Gelman-Rubin diagnostic (multichain), Effective Sample Size (ESS), Monte Carlo Standard Error (MCSE), and Highest Posterior Density (HPD) intervals.
compute_mcmc_diagnostics( chain, param_names = NULL, frac1 = 0.1, frac2 = 0.5, prob = 0.95 )compute_mcmc_diagnostics( chain, param_names = NULL, frac1 = 0.1, frac2 = 0.5, prob = 0.95 )
chain |
Numeric matrix of MCMC samples (iterations x parameters). |
param_names |
Character vector of parameter names. |
frac1 |
Fraction of chain to use for Geweke test first part (default 0.1). |
frac2 |
Fraction of chain to use for Geweke test second part (default 0.5). |
prob |
Credibility level for HPD intervals (default 0.95). |
A data frame containing posterior summary statistics and diagnostics.
Evaluates the probabilities of zero-failure , cure fraction ,
susceptible fraction , and the latent Poisson parameter .
compute_p0_p1(X1, X2, beta1, beta2)compute_p0_p1(X1, X2, beta1, beta2)
X1 |
Design matrix for zero-inflation linear predictor. |
X2 |
Design matrix for cure fraction linear predictor. |
beta1 |
Numeric vector of coefficients for zero-inflation. |
beta2 |
Numeric vector of coefficients for cure fraction. |
A list containing p0, p1, theta, and susceptible.
Computes the unconditional joint survival functions and the
observation probabilities for all subsets of malfunctioned
components under the shared gamma frailty model.
compute_probabilities( par, X_cov, tau, M, baseline = c("weibull", "exponential"), frailty = TRUE, powerset = NULL )compute_probabilities( par, X_cov, tau, M, baseline = c("weibull", "exponential"), frailty = TRUE, powerset = NULL )
par |
A numeric vector of model parameters: scale coefficients |
X_cov |
A numeric matrix of covariates (with leading column of ones for intercept),
having |
tau |
A non-negative numeric vector of inspection times. |
M |
An integer specifying the number of components ( |
baseline |
A character string: |
frailty |
A logical value: |
powerset |
An optional list of power set subsets generated by |
For a subset , the unconditional joint survival probability is
when , and
when . By the principle of inclusion-exclusion, the probability of observing
exactly the malfunctioned subset is
where .
Missing values are not permitted in par, X_cov, or tau.
A list containing:
An numeric matrix of subset probabilities .
An numeric matrix of scale parameters .
An numeric matrix of shape parameters .
A non-negative numeric scalar representing frailty variance.
The list of power set subsets.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
X_cov <- matrix(c(1, 1, 374, 428), ncol = 2) tau <- c(8000, 2500) par <- c(-4.99, -0.005, -16.44, 0.018, 0.5) res <- compute_probabilities(par, X_cov, tau, M = 2, baseline = "exponential", frailty = TRUE) res$prob_matrixX_cov <- matrix(c(1, 1, 374, 428), ncol = 2) tau <- c(8000, 2500) par <- c(-4.99, -0.005, -16.44, 0.018, 0.5) res <- compute_probabilities(par, X_cov, tau, M = 2, baseline = "exponential", frailty = TRUE) res$prob_matrix
Computes the bivariate conditional dependence probability ratio .
cond_prob_rhr( t1, t2, x1 = NULL, x2 = NULL, beta = NULL, frailty = "WL", theta = 1, mu = NULL, theta2 = NULL, baseline = "GE", params1 = c(zeta = 1, delta = 1), params2 = c(zeta = 1, delta = 1) )cond_prob_rhr( t1, t2, x1 = NULL, x2 = NULL, beta = NULL, frailty = "WL", theta = 1, mu = NULL, theta2 = NULL, baseline = "GE", params1 = c(zeta = 1, delta = 1), params2 = c(zeta = 1, delta = 1) )
t1 |
Numeric scalar or vector of first component times. |
t2 |
Numeric scalar or vector of second component times. |
x1 |
Numeric matrix or vector of covariates for first component. |
x2 |
Numeric matrix or vector of covariates for second component. |
beta |
Numeric vector of regression coefficients. |
frailty |
Character string indicating frailty distribution. |
theta |
Numeric parameter for frailty distribution. |
mu |
Optional secondary parameter for |
theta2 |
Optional second parameter for |
baseline |
Character string indicating baseline distribution. |
params1 |
Numeric named vector of baseline parameters for first component. |
params2 |
Numeric named vector of baseline parameters for second component. |
Numeric vector of conditional probability ratios.
cond_prob_rhr(15, 18, frailty = "WL", theta = 3.4, baseline = "GE", params1 = c(zeta = 12.4, delta = 0.11), params2 = c(zeta = 11.8, delta = 0.11))cond_prob_rhr(15, 18, frailty = "WL", theta = 3.4, baseline = "GE", params1 = c(zeta = 12.4, delta = 0.11), params2 = c(zeta = 11.8, delta = 0.11))
Computes asymptotic confidence intervals for parameters of a "oneshot_kofm" model.
## S3 method for class 'oneshot_kofm' confint(object, parm, level = 0.95, ...)## S3 method for class 'oneshot_kofm' confint(object, parm, level = 0.95, ...)
object |
A fitted model object of class |
parm |
A specification of which parameters are to be given confidence intervals. |
level |
The confidence level required (default 0.95). |
... |
Additional arguments. |
A numeric matrix with columns LCI and UCI.
Fits parametric correlated frailty models to bivariate right-censored survival data using Bayesian Markov Chain Monte Carlo (MCMC) simulation or Maximum Likelihood Estimation (MLE). Supports Correlated Gamma, Inverse Gaussian, Positive Stable, and Compound Poisson frailty distributions paired with Generalized Weibull, Generalized Log-Logistic, Weibull, Exponential, Pareto, Linear Failure Rate, and Burr (Type XII) baseline hazards.
corrFrailty( formula, data, id = NULL, frailty = c("gamma", "invgaussian", "posstable", "comppoisson", "none"), baseline = c("genweibull", "genloglogistic", "weibull", "exponential", "pareto", "lfr", "burr"), baseline2 = baseline, method = c("mcmc", "mle"), control = corrFrailty.control(), ... )corrFrailty( formula, data, id = NULL, frailty = c("gamma", "invgaussian", "posstable", "comppoisson", "none"), baseline = c("genweibull", "genloglogistic", "weibull", "exponential", "pareto", "lfr", "burr"), baseline2 = baseline, method = c("mcmc", "mle"), control = corrFrailty.control(), ... )
formula |
A formula object. For wide format data, use |
data |
A data.frame containing the survival times, censoring indicators, and covariates. |
id |
Optional variable identifying paired observations in long format data (must have exactly 2 observations per cluster). |
frailty |
Character specifying the frailty distribution. One of |
baseline |
Character specifying the baseline hazard distribution for the first survival time T1.
One of |
baseline2 |
Character specifying the baseline hazard distribution for the second survival time T2.
Defaults to the same distribution as |
method |
Character specifying the estimation method: |
control |
List of control parameters created by |
... |
Additional arguments passed to control parameters. |
An object of class "corrFrailty" containing:
coefficients |
Point estimates (posterior means for MCMC, MLEs for MLE). |
summary.table |
Detailed table of estimates, standard errors, credible/confidence intervals, and diagnostics. |
method |
Estimation method used ( |
frailty |
Frailty distribution. |
baseline1 |
Baseline hazard distribution for T1. |
baseline2 |
Baseline hazard distribution for T2. |
logLik |
Log-likelihood evaluated at parameter estimates. |
deviance |
Deviance (-2 * logLik). |
AIC |
Akaike Information Criterion. |
BIC |
Bayesian Information Criterion. |
DIC |
Deviance Information Criterion (for MCMC). |
pD |
Effective number of parameters (for MCMC). |
LPML |
Log Pseudo-Marginal Likelihood (for MCMC). |
chains |
List of MCMC chains (for MCMC). |
all.samples |
Matrix of pooled posterior samples (for MCMC). |
call |
The matched function call. |
data |
The processed data matrix used for model fitting. |
Shikhar Tyagi, Arvind Pandey, Vrijesh Tripathi
Hanagal, D. D., Pandey, A., and Ganguly, A. (2017). Correlated gamma frailty models for bivariate survival data. Communications in Statistics - Simulation and Computation, 46(5), 3627-3644. <doi:10.1080/03610918.2015.1085559>
Hanagal, D. D. and Pandey, A. (2018). Correlated inverse Gaussian frailty models for bivariate survival data. Communications in Statistics - Theory and Methods, 49(14), 3455-3475. <doi:10.1080/03610926.2018.1549256>
Hanagal, D. D. (2020). Correlated positive stable frailty models. Communications in Statistics - Theory and Methods, 51(8), 2419-2436. <doi:10.1080/03610926.2020.1736305>
Hanagal, D. D. (2020). Analysis of Kidney infection Data Using Correlated Inverse Gaussian Frailty Model. Statistics and Applications, 18(1), 1-19.
# Simulate small bivariate survival dataset set.seed(123) dat <- sim_corrFrailty(n = 30, frailty = "gamma", frailty.params = list(sigma = 0.5, rho = 0.4), baseline = "exponential", baseline.params = list(lambda = 0.05), beta = c(0.3), seed = 123) # Fit Correlated Gamma Frailty Model using MCMC fit <- corrFrailty(Surv(t1, d1, t2, d2) ~ x1, data = dat, frailty = "gamma", baseline = "exponential", method = "mcmc", control = corrFrailty.control(n.iter = 100, n.burnin = 20, n.thin = 1, n.chains = 1)) print(fit) summary(fit)# Simulate small bivariate survival dataset set.seed(123) dat <- sim_corrFrailty(n = 30, frailty = "gamma", frailty.params = list(sigma = 0.5, rho = 0.4), baseline = "exponential", baseline.params = list(lambda = 0.05), beta = c(0.3), seed = 123) # Fit Correlated Gamma Frailty Model using MCMC fit <- corrFrailty(Surv(t1, d1, t2, d2) ~ x1, data = dat, frailty = "gamma", baseline = "exponential", method = "mcmc", control = corrFrailty.control(n.iter = 100, n.burnin = 20, n.thin = 1, n.chains = 1)) print(fit) summary(fit)
Auxiliary function for setting MCMC and MLE optimization control parameters
in corrFrailty.
corrFrailty.control( n.iter = 5000, n.burnin = 1000, n.thin = 5, n.chains = 2, init = NULL, tune = NULL, adapt.iter = 500, priors = list(), seed = NULL, optim.method = "BFGS", optim.control = list() )corrFrailty.control( n.iter = 5000, n.burnin = 1000, n.thin = 5, n.chains = 2, init = NULL, tune = NULL, adapt.iter = 500, priors = list(), seed = NULL, optim.method = "BFGS", optim.control = list() )
n.iter |
Integer, total number of MCMC iterations per chain. Default is 5000. |
n.burnin |
Integer, number of burn-in iterations to discard. Default is 1000. |
n.thin |
Integer, thinning interval. Default is 5. |
n.chains |
Integer, number of parallel/independent MCMC chains. Default is 2. |
init |
Optional list of initial value vectors (one per chain). |
tune |
Optional numeric vector of initial proposal standard deviations. |
adapt.iter |
Integer, number of iterations during burn-in to adapt proposal standard deviations. Default is 500. |
priors |
Optional list specifying prior hyperparameters. |
seed |
Optional integer random seed for reproducibility. |
optim.method |
Character, optimization algorithm for MLE. Default is |
optim.control |
List of control parameters passed to |
A list with specified control parameters.
Shikhar Tyagi, Arvind Pandey, Vrijesh Tripathi
ctrl <- corrFrailty.control(n.iter = 1000, n.burnin = 200, n.chains = 2)ctrl <- corrFrailty.control(n.iter = 1000, n.burnin = 200, n.chains = 2)
Conditional Predictive Ordinate (CPO) and Log Pseudo Marginal Likelihood (LPML)
cpo(object)cpo(object)
object |
An object of class |
A list containing vector CPO and scalar LPML.
Computes the cumulative reversed hazard rate (CRHR), defined as .
crhr_baseline( t, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )crhr_baseline( t, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )
t |
Numeric vector of positive failure times. |
dist |
Character string specifying baseline distribution. |
params |
Numeric named vector of baseline parameters. |
Numeric vector of cumulative reversed hazard rate values.
crhr_baseline(c(10, 20, 30), dist = "GE", params = c(zeta = 12.4, delta = 0.11))crhr_baseline(c(10, 20, 30), dist = "GE", params = c(zeta = 12.4, delta = 0.11))
Computes AIC, BIC, Corrected AIC (AICc), Hannan-Quinn Criterion (HQIC), Deviance Information Criterion (DIC), and Bayes Factors for additive shared frailty models.
calc_model_criteria( loglik, k, n, deviance_samples = NULL, deviance_at_mean = NULL ) calc_bayes_factor(fit1, fit2)calc_model_criteria( loglik, k, n, deviance_samples = NULL, deviance_at_mean = NULL ) calc_bayes_factor(fit1, fit2)
loglik |
Scalar maximized or posterior mean log-likelihood value. |
k |
Number of estimated model parameters. |
n |
Sample size (number of subjects/pairs). |
deviance_samples |
Optional numeric vector of posterior deviances (-2 * logLik) for DIC calculation. |
deviance_at_mean |
Optional scalar deviance evaluated at the posterior mean of parameters. |
fit1, fit2
|
Fitted model objects of class |
For calc_model_criteria, a named list of information criteria.
For calc_bayes_factor, a scalar Bayes factor comparing fit1 against fit2.
Pandey, A., Hanagal, D. D., and Tyagi, S. (2022). Generalised Lindley shared additive frailty regression model for bivariate survival data. Statistics in Transition new series, 23(4), 161-176. doi:10.2478/stattrans-2022-0048
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
# Calculate information criteria calc_model_criteria(loglik = -330.5, k = 13, n = 38)# Calculate information criteria calc_model_criteria(loglik = -330.5, k = 13, n = 38)
Computes the bivariate Clayton-Oakes cross-ratio association measure .
cross_ratio_rhr( t1, t2, x1 = NULL, x2 = NULL, beta = NULL, frailty = "WL", theta = 1, mu = NULL, theta2 = NULL, baseline = "GE", params1 = c(zeta = 1, delta = 1), params2 = c(zeta = 1, delta = 1) )cross_ratio_rhr( t1, t2, x1 = NULL, x2 = NULL, beta = NULL, frailty = "WL", theta = 1, mu = NULL, theta2 = NULL, baseline = "GE", params1 = c(zeta = 1, delta = 1), params2 = c(zeta = 1, delta = 1) )
t1 |
Numeric scalar or vector of first component times. |
t2 |
Numeric scalar or vector of second component times. |
x1 |
Numeric matrix or vector of covariates for first component. |
x2 |
Numeric matrix or vector of covariates for second component. |
beta |
Numeric vector of regression coefficients. |
frailty |
Character string indicating frailty distribution. |
theta |
Numeric parameter for frailty distribution. |
mu |
Optional secondary parameter for |
theta2 |
Optional second parameter for |
baseline |
Character string indicating baseline distribution. |
params1 |
Numeric named vector of baseline parameters for first component. |
params2 |
Numeric named vector of baseline parameters for second component. |
Numeric vector of cross-ratio values.
cross_ratio_rhr(15, 18, frailty = "WL", theta = 3.4, baseline = "GE", params1 = c(zeta = 12.4, delta = 0.11), params2 = c(zeta = 11.8, delta = 0.11))cross_ratio_rhr(15, 18, frailty = "WL", theta = 3.4, baseline = "GE", params1 = c(zeta = 12.4, delta = 0.11), params2 = c(zeta = 11.8, delta = 0.11))
Computes the probability density function (PDF) for various baseline distributions used in reversed hazard rate frailty models.
d_rhr_baseline( t, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )d_rhr_baseline( t, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )
t |
Numeric vector of positive failure times. |
dist |
Character string specifying baseline distribution. One of |
params |
Numeric named vector of baseline parameters. |
Numeric vector of density values.
d_rhr_baseline(c(10, 20, 30), dist = "GE", params = c(zeta = 12.4, delta = 0.11)) d_rhr_baseline(c(10, 20, 30), dist = "EG", params = c(zeta = 9.1, delta = 0.10))d_rhr_baseline(c(10, 20, 30), dist = "GE", params = c(zeta = 12.4, delta = 0.11)) d_rhr_baseline(c(10, 20, 30), dist = "EG", params = c(zeta = 9.1, delta = 0.10))
Computes . Note that .
d2laplace_frailty( s, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )d2laplace_frailty( s, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )
s |
Numeric vector of non-negative arguments. |
frailty |
Character string indicating the frailty distribution. |
theta |
Numeric parameter for frailty distribution. |
mu |
Optional secondary parameter for |
theta2 |
Optional second parameter for |
Numeric vector of second derivative values.
d2laplace_frailty(c(0.1, 0.5, 1.0), frailty = "WL", theta = 3.4)d2laplace_frailty(c(0.1, 0.5, 1.0), frailty = "WL", theta = 3.4)
Computes for under Minimum, Maximum,
and Random activation schemes with Gamma frailty.
dens_proper( t, theta, alpha, shape, scale, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )dens_proper( t, theta, alpha, shape, scale, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )
t |
Numeric vector of positive survival times. |
theta |
Numeric vector or scalar representing the latent Poisson parameter (> 0). |
alpha |
Numeric scalar representing Gamma frailty variance (>= 0). |
shape |
Numeric vector or scalar representing baseline shape parameter(s) (> 0). |
scale |
Numeric vector or scalar representing baseline scale parameter(s) (> 0). |
activation |
Character string indicating the activation scheme:
|
baseline |
Character string indicating the baseline hazard distribution:
|
Numeric vector of proper conditional density values.
Computes Kendall's tau (rank-based association) and theoretical frailty variance for additive shared frailty models under Generalized Lindley, Weighted Lindley, Gamma, and Inverse Gaussian frailty distributions.
kendall_tau( frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), theta = NULL, mu = NULL, s_param = NULL ) frailty_variance( frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), theta = NULL, mu = NULL, s_param = NULL )kendall_tau( frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), theta = NULL, mu = NULL, s_param = NULL ) frailty_variance( frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), theta = NULL, mu = NULL, s_param = NULL )
frailty_type |
Character string specifying the frailty distribution:
|
theta |
Positive parameter for Generalized Lindley, Gamma, or Inverse Gaussian frailty. |
mu |
Positive parameter for Generalized Lindley frailty (with |
s_param |
Positive shape parameter for Weighted Lindley frailty. |
A scalar numeric value representing Kendall's tau or theoretical frailty variance.
Pandey, A., Hanagal, D. D., and Tyagi, S. (2022). Generalised Lindley shared additive frailty regression model for bivariate survival data. Statistics in Transition new series, 23(4), 161-176. doi:10.2478/stattrans-2022-0048
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
# Kendall's tau for Generalized Lindley frailty kendall_tau(frailty_type = "genlindley", theta = 2.29258, mu = 1.38391) # Kendall's tau for Weighted Lindley frailty kendall_tau(frailty_type = "wlindley", s_param = 1.0955) # Frailty variances frailty_variance(frailty_type = "genlindley", theta = 2.29, mu = 1.38) frailty_variance(frailty_type = "wlindley", s_param = 1.10)# Kendall's tau for Generalized Lindley frailty kendall_tau(frailty_type = "genlindley", theta = 2.29258, mu = 1.38391) # Kendall's tau for Weighted Lindley frailty kendall_tau(frailty_type = "wlindley", s_param = 1.0955) # Frailty variances frailty_variance(frailty_type = "genlindley", theta = 2.29, mu = 1.38) frailty_variance(frailty_type = "wlindley", s_param = 1.10)
Computes Geweke z-score, Heidelberger-Welch stationarity test p-value, and effective sample size (ESS).
diagnostics_mcmc(mcmc_matrix, frac1 = 0.1, frac2 = 0.5)diagnostics_mcmc(mcmc_matrix, frac1 = 0.1, frac2 = 0.5)
mcmc_matrix |
Numeric matrix or data frame where each column represents posterior draws for a parameter. |
frac1 |
Fraction of samples to use from the beginning for the Geweke test. Default is |
frac2 |
Fraction of samples to use from the end for the Geweke test. Default is |
Evaluates MCMC chain convergence and stationarity for each parameter column in mcmc_matrix.
The Geweke diagnostic compares sample means from the beginning (frac1) and end (frac2) of the chain.
The Heidelberger-Welch test performs a Cramer-von Mises stationarity test on the cumulative sum of centered draws.
Effective sample size (ESS) adjusts for chain autocorrelation.
Missing values (NA or NaN) in input matrices are not permitted.
A data frame with one row per parameter containing the following columns:
ParameterName of the parameter.
Geweke_ZGeweke test z-score.
Geweke_pTwo-sided p-value for the Geweke test (p-value > 0.05 indicates convergence).
Heidelberger_pStationarity test p-value (p-value > 0.05 indicates stationary chain).
ESSEffective sample size adjusted for autocorrelation.
set.seed(123) mat <- cbind(param1 = stats::rnorm(500), param2 = stats::rgamma(500, 2, 1)) diagnostics_mcmc(mat)set.seed(123) mat <- cbind(param1 = stats::rnorm(500), param2 = stats::rgamma(500, 2, 1)) diagnostics_mcmc(mat)
Calculates DIC for a Bayesian frailty model.
dic(object)dic(object)
object |
An object of class |
A list with elements DIC, D_bar, D_hat, and p_D.
data(kidney_frailty) fit <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, n_iter = 200, burn_in = 50) dic(fit)data(kidney_frailty) fit <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, n_iter = 200, burn_in = 50) dic(fit)
Computes . Note that .
dlaplace_frailty( s, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )dlaplace_frailty( s, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )
s |
Numeric vector of non-negative arguments. |
frailty |
Character string indicating the frailty distribution. |
theta |
Numeric parameter for frailty distribution. |
mu |
Optional secondary parameter for |
theta2 |
Optional second parameter for |
Numeric vector of first derivative values.
dlaplace_frailty(c(0.1, 0.5, 1.0), frailty = "WL", theta = 3.4)dlaplace_frailty(c(0.1, 0.5, 1.0), frailty = "WL", theta = 3.4)
Expected Akaike Information Criterion (EAIC)
eaic(object)eaic(object)
object |
An object of class |
Numeric EAIC value.
Expected Bayesian Information Criterion (EBIC)
ebic(object)ebic(object)
object |
An object of class |
Numeric EBIC value.
Implements the EM algorithm developed by Yu, So, and Balakrishnan (2025) for computing maximum likelihood estimates in one-shot device testing under a shared gamma frailty model with Weibull or Exponential baseline lifetime distributions.
em_oneshot_frailty( count_mat, X_cov, tau, M, baseline = c("weibull", "exponential"), frailty = TRUE, start = NULL, max_iter = 500, tol = 1e-05, trace = FALSE )em_oneshot_frailty( count_mat, X_cov, tau, M, baseline = c("weibull", "exponential"), frailty = TRUE, start = NULL, max_iter = 500, tol = 1e-05, trace = FALSE )
count_mat |
An |
X_cov |
An |
tau |
A positive numeric vector of length |
M |
An integer specifying the number of components ( |
baseline |
A character string: |
frailty |
A logical value: |
start |
Optional numeric vector of initial parameter values. |
max_iter |
An integer specifying the maximum number of EM iterations (default 500). |
tol |
A positive numeric scalar for convergence tolerance (default 1e-5). |
trace |
A logical value: |
The EM algorithm handles the completely censored one-shot device test data by treating
latent component failure times and latent frailty terms
as missing data.
In the **E-step**, the conditional expectations ,
, ,
and are computed using the closed-form and
incomplete beta expressions derived in Sections 1.4 and Appendix 1.B of the paper.
In the **M-step**, parameters , , and
are updated to maximize the expected complete log-likelihood .
Missing values are not permitted in any input data.
A list containing:
Numeric vector of maximum likelihood parameter estimates.
Maximized observed log-likelihood value.
Number of EM iterations completed.
Logical flag indicating whether the algorithm converged (TRUE or FALSE).
A data frame recording the log-likelihood and parameter norm across iterations.
Yu, C., So, H. Y., and Balakrishnan, N. (2025). Inference for one-shot devices with Weibull component lifetimes under gamma frailty model. In: Stochastic Modeling and Statistical Methods, Elsevier Inc., Chapter 1, pp. 1–34. doi:10.1016/B978-0-44-331694-4.00006-2.
data(classH) X_cov <- cbind(1, classH$stress) tau <- classH$time count_mat <- as.matrix(classH[, c("n_none", "n_T", "n_G", "n_both")]) fit_em <- em_oneshot_frailty(count_mat, X_cov, tau, M = 2, baseline = "weibull", frailty = TRUE, max_iter = 25, tol = 1e-4) fit_em$pardata(classH) X_cov <- cbind(1, classH$stress) tau <- classH$time count_mat <- as.matrix(classH[, c("n_none", "n_T", "n_G", "n_both")]) fit_em <- em_oneshot_frailty(count_mat, X_cov, tau, M = 2, baseline = "weibull", frailty = TRUE, max_iter = 25, tol = 1e-4) fit_em$par
Implements the Expectation-Maximization (EM) algorithm developed by Ling et al. (2021) for determining the maximum likelihood estimates of model parameters for one-shot devices with multiple dependent failure modes under gamma frailty.
em_oneshot_kofm( count_mat, X_cov, tau, M, baseline = c("exponential", "weibull"), frailty = TRUE, start = NULL, max_iter = 500, tol = 1e-05, trace = FALSE )em_oneshot_kofm( count_mat, X_cov, tau, M, baseline = c("exponential", "weibull"), frailty = TRUE, start = NULL, max_iter = 500, tol = 1e-05, trace = FALSE )
count_mat |
An |
X_cov |
An |
tau |
A positive numeric vector of length |
M |
An integer specifying the number of components ( |
baseline |
A character string: |
frailty |
A logical value: |
start |
Optional numeric vector of initial parameter values. |
max_iter |
An integer specifying the maximum number of EM iterations (default 500). |
tol |
A positive numeric scalar for convergence tolerance (default 1e-5). |
trace |
A logical value: |
The EM algorithm treats latent component failure times and latent
device frailties as unobserved data.
In the **E-step**, exact closed-form expressions for the conditional expectations
, , and
are computed via inclusion-exclusion formulas (Equations 12–15 of Ling et al., 2021).
In the **M-step**, the parameter maximization problem decouples into
separate 2-parameter optimization subproblems for each failure mode
(Equations 9–10) and one 1-parameter root-finding problem for
(Equation 11), ensuring rapid convergence and numerical stability.
Missing values are not permitted.
A list containing:
Numeric vector of maximum likelihood parameter estimates.
Maximized observed log-likelihood value.
Number of EM iterations completed.
Logical flag indicating whether the algorithm converged (TRUE or FALSE).
A data frame recording the log-likelihood and parameter norm across iterations.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
data(classH) X_cov <- cbind(1, classH$stress) tau <- classH$time count_mat <- as.matrix(classH[, c("n_none", "n_T", "n_G", "n_both")]) fit_em <- em_oneshot_kofm(count_mat, X_cov, tau, M = 2, baseline = "exponential", frailty = TRUE, max_iter = 50, tol = 1e-4) fit_em$pardata(classH) X_cov <- cbind(1, classH$stress) tau <- classH$time count_mat <- as.matrix(classH[, c("n_none", "n_T", "n_G", "n_both")]) fit_em <- em_oneshot_kofm(count_mat, X_cov, tau, M = 2, baseline = "exponential", frailty = TRUE, max_iter = 50, tol = 1e-4) fit_em$par
Computes statistical goodness-of-fit and forecast accuracy measures including Mean Squared Error (MSE), Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), Brier Score, and Harrell's Concordance Index (C-index), as well as exact normalized randomized quantile residuals.
evaluate_ziprom(object, newdata = NULL, times = NULL, ...) ziprom_residuals(object, ...)evaluate_ziprom(object, newdata = NULL, times = NULL, ...) ziprom_residuals(object, ...)
object |
An object of class |
newdata |
Optional new data frame to evaluate model performance on out-of-sample data. |
times |
Optional numeric evaluation times for Brier Score / MSE. |
... |
Additional arguments. |
For evaluate_ziprom: A list containing:
MSEMean Squared Error between observed status and fitted survival probabilities.
RMSERoot Mean Squared Error ().
MAEMean Absolute Error.
Brier_ScoreIntegrated / average Brier score across time horizon.
C_indexHarrell's Concordance Index (discrimination metric).
LogLikMaximum Log-Likelihood value.
AICAkaike Information Criterion.
BICBayesian Information Criterion.
CAICConsistent Akaike Information Criterion.
HQICHannan-Quinn Information Criterion.
For ziprom_residuals: A numeric vector of normalized randomized quantile residuals.
Dunn, P. K., and Smyth, G. K. (1996). Randomized Quantile Residuals. Journal of Computational and Graphical Statistics, 5(3), 236-244. doi:10.1080/10618600.1996.10474708
Assuncao, D., Ramos, P. L., Tomazella, V., Leao, J., Osses, L., and Rodrigues, A. (2026). Zero-Inflated Promotion Cure-Rate Models With Frailty and Flexible Activation Schemes. Biometrical Journal, 68:e70162. doi:10.1002/bimj.70162
set.seed(42) sim_dat <- sim_ziprom(n = 80, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random") evals <- evaluate_ziprom(fit) print(evals)set.seed(42) sim_dat <- sim_ziprom(n = 80, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random") evals <- evaluate_ziprom(fit) print(evals)
Generates synthetic survival datasets under any supported baseline hazard and frailty distribution with right censoring.
fb_sim_frailty( n = 100, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate", beta = c(0.5, -0.5), theta = 1, baseline_params = c(0.01, 1.2), censor_rate = 0.2 )fb_sim_frailty( n = 100, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate", beta = c(0.5, -0.5), theta = 1, baseline_params = c(0.01, 1.2), censor_rate = 0.2 )
n |
Sample size (number of subjects/clusters). |
baseline |
Baseline hazard name (default |
frailty |
Frailty distribution name (default |
type |
Model type (default |
beta |
Regression coefficients vector. |
theta |
Frailty parameter(s). |
baseline_params |
Baseline parameters vector. |
censor_rate |
Right-censoring probability. |
A data frame containing simulated survival times, status indicators, covariates, and true frailty values.
sim_data <- sim_frailty( n = 50, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate", beta = c(0.5, -0.5), theta = 1.5, baseline_params = c(0.02, 1.2) ) head(sim_data)sim_data <- sim_frailty( n = 50, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate", beta = c(0.5, -0.5), theta = 1.5, baseline_params = c(0.02, 1.2) ) head(sim_data)
Computes the observed Fisher information matrix for model parameters in one-shot device testing based on the missing information principle and exact analytical derivatives derived in Ling et al. (2021).
fisher_info_oneshot( par, count_mat, X_cov, tau, M, baseline = c("weibull", "exponential"), frailty = TRUE, powerset = NULL )fisher_info_oneshot( par, count_mat, X_cov, tau, M, baseline = c("weibull", "exponential"), frailty = TRUE, powerset = NULL )
par |
Numeric vector of estimated model parameters. |
count_mat |
An |
X_cov |
An |
tau |
A positive numeric vector of inspection times. |
M |
An integer specifying the number of components. |
baseline |
A character string: |
frailty |
A logical value: |
powerset |
An optional list of power set subsets. |
The missing information principle gives the observed Fisher information matrix as:
Missing values are not permitted.
A symmetric positive semi-definite numeric matrix representing the observed Fisher information matrix.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
data(classH) X_cov <- cbind(1, classH$stress) tau <- classH$time count_mat <- as.matrix(classH[, c("n_none", "n_T", "n_G", "n_both")]) par <- c(-4.9897, -0.0058, -16.4365, 0.0183, 0.5) fisher_info_oneshot(par, count_mat, X_cov, tau, M = 2, baseline = "exponential", frailty = TRUE)data(classH) X_cov <- cbind(1, classH$stress) tau <- classH$time count_mat <- as.matrix(classH[, c("n_none", "n_T", "n_G", "n_both")]) par <- c(-4.9897, -0.0058, -16.4365, 0.0183, 0.5) fisher_info_oneshot(par, count_mat, X_cov, tau, M = 2, baseline = "exponential", frailty = TRUE)
Fits additive shared frailty regression models for bivariate survival data using an adaptive hybrid Metropolis-Hastings Markov Chain Monte Carlo (MCMC) sampler with multiple chains, informative or flat priors, and point estimation under Squared Error, Modified Quadratic Squared Error, and Precautionary loss functions.
fit_add_frailty_bayes( formula = NULL, data, t1_col = "t1", delta1_col = "delta1", t2_col = "t2", delta2_col = "delta2", frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), baseline_dist = c("gw", "gll2"), n_iter = 10000, burn_in = 2000, thin = 5, n_chains = 2, prior = c("flat", "informative"), prior_params = NULL, init = NULL, seed = NULL, verbose = FALSE )fit_add_frailty_bayes( formula = NULL, data, t1_col = "t1", delta1_col = "delta1", t2_col = "t2", delta2_col = "delta2", frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), baseline_dist = c("gw", "gll2"), n_iter = 10000, burn_in = 2000, thin = 5, n_chains = 2, prior = c("flat", "informative"), prior_params = NULL, init = NULL, seed = NULL, verbose = FALSE )
formula |
Model formula for covariates (e.g. |
data |
A data frame containing survival times, censoring indicators, and covariates. |
t1_col |
Character string naming the first survival time column in |
delta1_col |
Character string naming the first censoring indicator column in |
t2_col |
Character string naming the second survival time column in |
delta2_col |
Character string naming the second censoring indicator column in |
frailty_type |
Character string specifying the frailty distribution:
|
baseline_dist |
Character string specifying the baseline distribution:
|
n_iter |
Total number of MCMC iterations per chain (default 10000). |
burn_in |
Number of initial burn-in iterations to discard (default 2000). |
thin |
Thinning interval / autocorrelation lag (default 5). |
n_chains |
Number of parallel/independent Markov chains to run (default 2). |
prior |
Character string specifying prior distribution: |
prior_params |
Optional list of hyperparameters for informative priors. |
init |
Optional list or vector of initial parameter values. |
seed |
Optional integer seed for reproducibility. |
verbose |
Logical; if |
An object of class c("add_frailty_bayes", "add_frailty") containing:
Data frame of Bayes point estimates (SELF, MQSELF, PLF), risks, and credible intervals.
List of thinned posterior sample matrices for each chain.
Combined posterior sample matrix across all chains.
Posterior deviance samples (-2 * logLik).
List containing Geweke, Gelman-Rubin, and Heidelberger-Welch convergence statistics.
Model selection criteria (AIC, BIC, AICc, HQIC, DIC, LogLik).
Kendall's tau dependence measure evaluated at the Bayes estimate.
Theoretical frailty variance at the Bayes estimate.
List containing model settings, formula, call, and data dimensions.
Pandey, A., Hanagal, D. D., and Tyagi, S. (2022). Generalised Lindley shared additive frailty regression model for bivariate survival data. Statistics in Transition new series, 23(4), 161-176. doi:10.2478/stattrans-2022-0048
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
data(kidney_bivariate) sub_data <- kidney_bivariate[1:20, ] fit_bayes <- fit_add_frailty_bayes( formula = ~ age, data = sub_data, frailty_type = "wlindley", baseline_dist = "gw", n_iter = 200, burn_in = 50, thin = 2, n_chains = 2, seed = 123 ) print(fit_bayes)data(kidney_bivariate) sub_data <- kidney_bivariate[1:20, ] fit_bayes <- fit_add_frailty_bayes( formula = ~ age, data = sub_data, frailty_type = "wlindley", baseline_dist = "gw", n_iter = 200, burn_in = 50, thin = 2, n_chains = 2, seed = 123 ) print(fit_bayes)
Estimates unknown parameters of additive shared frailty models under bivariate random censoring using numerical optimization of the log-likelihood with transformation for bounded parameters and Hessian-based standard errors.
fit_add_frailty_mle( formula = NULL, data, t1_col = "t1", delta1_col = "delta1", t2_col = "t2", delta2_col = "delta2", frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), baseline_dist = c("gw", "gll2"), init = NULL, method = "Nelder-Mead", hessian = TRUE, control = list(maxit = 5000) )fit_add_frailty_mle( formula = NULL, data, t1_col = "t1", delta1_col = "delta1", t2_col = "t2", delta2_col = "delta2", frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), baseline_dist = c("gw", "gll2"), init = NULL, method = "Nelder-Mead", hessian = TRUE, control = list(maxit = 5000) )
formula |
Model formula for covariates (e.g. |
data |
A data frame containing survival times, censoring indicators, and covariates. |
t1_col |
Character string naming the first survival time column in |
delta1_col |
Character string naming the first censoring indicator column in |
t2_col |
Character string naming the second survival time column in |
delta2_col |
Character string naming the second censoring indicator column in |
frailty_type |
Character string specifying the frailty distribution:
|
baseline_dist |
Character string specifying the baseline distribution:
|
init |
Optional numeric vector of initial parameter values. |
method |
Optimization method passed to |
hessian |
Logical; if |
control |
List of control parameters passed to |
An object of class c("add_frailty_mle", "add_frailty") containing:
Named vector of Maximum Likelihood parameter estimates.
Data frame containing estimates, standard errors, z-values, p-values, and 95% confidence bounds.
Asymptotic covariance matrix of the estimates.
Maximized log-likelihood value.
Named list of AIC, BIC, AICc, HQIC values.
Kendall's tau dependence measure evaluated at the MLE.
Theoretical frailty variance evaluated at the MLE.
Convergence code from stats::optim.
List containing model specifications and call.
Pandey, A., Hanagal, D. D., and Tyagi, S. (2022). Generalised Lindley shared additive frailty regression model for bivariate survival data. Statistics in Transition new series, 23(4), 161-176. doi:10.2478/stattrans-2022-0048
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
data(kidney_bivariate) sub_data <- kidney_bivariate[1:20, ] fit_mle <- fit_add_frailty_mle( formula = ~ age, data = sub_data, frailty_type = "wlindley", baseline_dist = "gw", control = list(maxit = 100) ) print(fit_mle)data(kidney_bivariate) sub_data <- kidney_bivariate[1:20, ] fit_mle <- fit_add_frailty_mle( formula = ~ age, data = sub_data, frailty_type = "wlindley", baseline_dist = "gw", control = list(maxit = 100) ) print(fit_mle)
Fits shared frailty regression models for bivariate left-censored survival data based on reversed hazard rates using an adaptive Metropolis-within-Gibbs MCMC algorithm. Provides posterior estimates under squared error (SELF), entropy (ELF), and precautionary (PLF) loss functions, highest posterior density (HPD) credible intervals, and model comparison criteria.
fit_rhr_frailty_bayes( formula = NULL, data = NULL, t1 = NULL, t2 = NULL, d1 = NULL, d2 = NULL, covars = NULL, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), baseline = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), n_iter = 2000, burn_in = 500, thin = 1, n_chains = 1, prior = c("flat", "informative"), prior_hyper = NULL, loss_functions = c("SELF", "ELF", "PLF"), init = NULL, tune_sd = NULL, verbose = FALSE, seed = NULL )fit_rhr_frailty_bayes( formula = NULL, data = NULL, t1 = NULL, t2 = NULL, d1 = NULL, d2 = NULL, covars = NULL, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), baseline = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), n_iter = 2000, burn_in = 500, thin = 1, n_chains = 1, prior = c("flat", "informative"), prior_hyper = NULL, loss_functions = c("SELF", "ELF", "PLF"), init = NULL, tune_sd = NULL, verbose = FALSE, seed = NULL )
formula |
An optional object of class |
data |
An optional data frame containing the variables in the model. |
t1 |
Numeric vector of first failure/censoring times (if formula is not provided). Must be positive. |
t2 |
Numeric vector of second failure/censoring times. Must be positive. |
d1 |
Numeric or integer vector of censoring indicators for first component ( |
d2 |
Numeric or integer vector of censoring indicators for second component ( |
covars |
Optional numeric matrix or data frame of covariates. |
frailty |
Character string specifying frailty distribution. One of |
baseline |
Character string specifying baseline distribution. One of |
n_iter |
Total number of MCMC iterations. Default is |
burn_in |
Number of initial burn-in iterations to discard. Default is |
thin |
Thinning interval. Default is |
n_chains |
Number of parallel MCMC chains. Default is |
prior |
Character string indicating prior specification: |
prior_hyper |
Optional named list of hyperparameters for informative gamma and normal priors. |
loss_functions |
Character vector of loss functions under which Bayes estimates are computed. Default is |
init |
Optional numeric vector of initial values for the parameters. |
tune_sd |
Optional numeric vector of proposal standard deviations for random-walk Metropolis updates. |
verbose |
Logical; if |
seed |
Optional integer seed for reproducibility. Default is |
The model assumes that the bivariate lifetime random variables share an unobserved
frailty variable that acts multiplicatively on the baseline reversed hazard rates:
Under left censoring, observations with indicate that the event occurred before or at
the observation time (), while indicates an exact observed failure time.
Missing values (NA or NaN) in survival times or censoring indicators are not allowed and will produce an informative error.
An object of class "rhr_bayes_fit" with the following components:
summaryA data frame summarizing parameter estimates under SELF, ELF, and PLF loss functions, posterior standard deviations, Monte Carlo standard errors (MCSE), medians, 95% HPD credible intervals, Geweke test p-values, and Heidelberger-Welch stationarity test p-values.
drawsA numeric matrix of kept posterior parameter draws of dimension ((n_iter - burn_in) / thin) * n_chains by n_params.
chainsA list of chains containing kept parameter draws, log-likelihoods, and inverse pointwise likelihoods.
estimatesA named list containing numeric vectors of Bayes point estimates under SELF (Posterior Mean), ELF (Harmonic Mean), and PLF (Root Mean Square).
loss_functionsCharacter vector of loss functions evaluated.
diagnosticsA data frame containing MCMC convergence diagnostics including Geweke z-scores and p-values, Heidelberger-Welch p-values, and effective sample sizes (ESS).
criteriaA list of model fit and selection criteria: AIC, BIC, AICc, HQIC, DIC (Deviance Information Criterion), pD (effective number of parameters), EAIC, EBIC, LPML (Log Pseudo Marginal Likelihood), mean_deviance, and dev_at_mean.
cpoNumeric vector of conditional predictive ordinate (CPO) values for each observation pair.
kendall_tauNumeric scalar representing estimated Kendall's rank correlation coefficient .
frailty_varianceNumeric scalar representing estimated variance of the frailty variable .
model_infoA list containing model specifications: frailty distribution, baseline distribution, sample size , number of iterations, burn-in, thinning, number of chains, prior type, covariate names, and parameter names.
dataA list containing the input data vectors and covariate matrix.
callThe matched call.
data(austrian_twin) # Demonstration with a small subset and few iterations fit <- fit_rhr_frailty_bayes( cbind(t1, t2, d1, d2) ~ age + k2 + k3, data = austrian_twin[1:50, ], frailty = "WL", baseline = "GE", n_iter = 60, burn_in = 10, thin = 1 ) print(fit) summary(fit)data(austrian_twin) # Demonstration with a small subset and few iterations fit <- fit_rhr_frailty_bayes( cbind(t1, t2, d1, d2) ~ age + k2 + k3, data = austrian_twin[1:50, ], frailty = "WL", baseline = "GE", n_iter = 60, burn_in = 10, thin = 1 ) print(fit) summary(fit)
Fits shared frailty regression models for bivariate left-censored survival data based on reversed hazard rates using maximum likelihood estimation.
fit_rhr_frailty_mle( formula = NULL, data = NULL, t1 = NULL, t2 = NULL, d1 = NULL, d2 = NULL, covars = NULL, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), baseline = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), init = NULL, hessian = TRUE, control = list() )fit_rhr_frailty_mle( formula = NULL, data = NULL, t1 = NULL, t2 = NULL, d1 = NULL, d2 = NULL, covars = NULL, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), baseline = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), init = NULL, hessian = TRUE, control = list() )
formula |
An optional object of class |
data |
An optional data frame containing variables. |
t1 |
Numeric vector of first failure/censoring times. Must be positive. |
t2 |
Numeric vector of second failure/censoring times. Must be positive. |
d1 |
Numeric or integer vector of censoring indicators for first component ( |
d2 |
Numeric or integer vector of censoring indicators for second component ( |
covars |
Optional numeric matrix of covariates. |
frailty |
Character string specifying frailty distribution. Default is |
baseline |
Character string specifying baseline distribution. Default is |
init |
Optional numeric vector of initial parameters. |
hessian |
Logical indicating whether to compute observed Fisher information Hessian. Default is |
control |
Optional list of control parameters passed to |
Maximizes the four-part left-censored log-likelihood function using the BFGS algorithm
on unconstrained log-transformed parameter space to guarantee positive parameters.
Standard errors are computed from the numerical Hessian using the multivariate Delta Method.
Missing values (NA or NaN) in survival times or censoring indicators are not permitted.
An object of class "rhr_mle_fit" with the following components:
summaryA data frame containing parameter estimates, standard errors, z-scores, p-values, and Wald 95% confidence intervals.
coefficientsA named numeric vector of parameter estimates.
seA named numeric vector of asymptotic standard errors computed via the Delta Method.
vcovThe estimated asymptotic variance-covariance matrix.
loglikThe maximized log-likelihood value.
criteriaA list containing AIC, BIC, AICc, and HQIC information criteria.
kendall_tauNumeric scalar representing estimated Kendall's tau.
frailty_varianceNumeric scalar representing estimated variance of the frailty variable.
optThe raw optimization result returned by optim.
model_infoA list containing model specifications: frailty, baseline, sample size, number of covariates, covariate names, and parameter names.
dataA list containing the input data vectors and covariate matrix.
callThe matched call.
data(austrian_twin) fit <- fit_rhr_frailty_mle( cbind(t1, t2, d1, d2) ~ age + k2 + k3, data = austrian_twin[1:50, ], frailty = "WL", baseline = "GE" ) print(fit) summary(fit)data(austrian_twin) fit <- fit_rhr_frailty_mle( cbind(t1, t2, d1, d2) ~ age + k2 + k3, data = austrian_twin[1:50, ], frailty = "WL", baseline = "GE" ) print(fit) summary(fit)
Extracts fitted cell probabilities or expected counts from a "oneshot_kofm" object.
## S3 method for class 'oneshot_kofm' fitted(object, type = c("probs", "counts"), ...)## S3 method for class 'oneshot_kofm' fitted(object, type = c("probs", "counts"), ...)
object |
A fitted model object of class |
type |
A character string: |
... |
Additional arguments. |
A numeric matrix of fitted probabilities or expected counts.
Helper function for extracting survival forecasts with 90%, 95%, and 99% level of significance intervals.
forecast_ziprom( object, newdata = NULL, times = NULL, level = c(0.9, 0.95, 0.99), ... )forecast_ziprom( object, newdata = NULL, times = NULL, level = c(0.9, 0.95, 0.99), ... )
object |
An object of class |
newdata |
Optional data frame containing covariate values for forecasting. |
times |
Optional numeric vector of forecast time points. |
level |
Numeric vector of confidence levels. Default is |
... |
Additional arguments passed to |
A data frame of survival forecast probabilities with standard errors and multi-level significance intervals.
set.seed(123) dat <- sim_ziprom(n = 60, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = dat, activation = "random") fc_res <- forecast_ziprom(fit, times = c(0.5, 1.0, 2.0, 3.0, 5.0)) print(fc_res)set.seed(123) dat <- sim_ziprom(n = 60, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = dat, activation = "random") fc_res <- forecast_ziprom(fit, times = c(0.5, 1.0, 2.0, 3.0, 5.0)) print(fc_res)
Fits parametric shared multiplicative, shared additive, univariate multiplicative, univariate additive, and merged frailty survival models using adaptive Markov Chain Monte Carlo (MCMC) sampling.
frailty_bayes( formula, data, baseline = c("weibull", "exponential", "genexponential", "exppower", "lfr", "genloglogistic", "genweibull", "genrayleigh", "weightedexp", "extendedweibull"), frailty = c("gamma", "invgauss", "posstable", "compoundpoisson", "compoundnb", "genlindley", "weightedlindley", "mixture_invgauss"), type = c("multiplicative_bivariate", "additive_bivariate", "multiplicative_univariate", "additive_univariate", "merged_univariate"), n_iter = 3000, burn_in = 1000, thin = 1, priors = NULL, init = NULL, adapt_freq = 50, verbose = FALSE, ... )frailty_bayes( formula, data, baseline = c("weibull", "exponential", "genexponential", "exppower", "lfr", "genloglogistic", "genweibull", "genrayleigh", "weightedexp", "extendedweibull"), frailty = c("gamma", "invgauss", "posstable", "compoundpoisson", "compoundnb", "genlindley", "weightedlindley", "mixture_invgauss"), type = c("multiplicative_bivariate", "additive_bivariate", "multiplicative_univariate", "additive_univariate", "merged_univariate"), n_iter = 3000, burn_in = 1000, thin = 1, priors = NULL, init = NULL, adapt_freq = 50, verbose = FALSE, ... )
formula |
A formula expression, e.g. |
data |
A data.frame containing all survival variables and covariates. |
baseline |
Character specifying baseline distribution: |
frailty |
Character specifying frailty distribution: |
type |
Model formulation: |
n_iter |
Number of MCMC iterations saved post burn-in (default 3000). |
burn_in |
Number of burn-in iterations (default 1000). |
thin |
Thinning interval (default 1). |
priors |
List of prior distribution specifications (optional). |
init |
Vector of initial parameter values (optional). |
adapt_freq |
Frequency of proposal covariance matrix adaptation (default 50). |
verbose |
Logical; if |
... |
Additional arguments. |
An S3 object of class "frailty_bayes" containing:
chain |
Matrix of posterior draws for all parameters. |
summary |
Data frame of posterior summaries, credible intervals, ESS, MCSE, and Geweke diagnostics. |
diagnostics |
List containing DIC, EAIC, EBIC, CPO, and LPML model comparison criteria. |
log_lik_matrix |
Matrix of individual log-likelihoods across iterations. |
accept_rate |
MCMC acceptance rate. |
data |
Processed data list. |
call |
Matched call. |
baseline |
Baseline distribution name. |
frailty |
Frailty distribution name. |
type |
Model type. |
Hanagal, D. D. and Dabade, A. D. (2013). Compound negative binomial shared frailty models for bivariate survival data. Statistics and Probability Letters, 83(11): 2507-2515. doi:10.1016/j.spl.2013.07.015
Tyagi, S., Pandey, A., Agiwal, V. and Chesneau, C. (2021). Weighted Lindley multiplicative regression frailty models under random censored data. Computational and Applied Mathematics, 40: 265. doi:10.1007/s40314-021-01666-5
Kiprotich, G., Tyagi, S. and Ramos, P. L. (2025). Bayesian survival modeling with mixtures of inverse Gaussian frailties. Journal of Applied Statistics. doi:10.1080/02664763.2025.2560510
data(kidney_frailty) fit <- frailty_bayes( Surv(time1, time2, status1, status2) ~ age + sex, data = kidney_frailty, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate", n_iter = 500, burn_in = 100 ) print(fit) summary(fit)data(kidney_frailty) fit <- frailty_bayes( Surv(time1, time2, status1, status2) ~ age + sex, data = kidney_frailty, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate", n_iter = 500, burn_in = 100 ) print(fit) summary(fit)
Creates a unified comparison table ranking multiple fitted frailty models by DIC, EAIC, EBIC, LPML, AIC, and BIC.
frailty_compare(..., names = NULL)frailty_compare(..., names = NULL)
... |
One or more fitted objects of class |
names |
Optional character vector of model names. |
A data frame summarizing model comparison criteria and ranks.
data(kidney_frailty) m1 <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, frailty = "gamma", n_iter = 200, burn_in = 50) m2 <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, frailty = "invgauss", n_iter = 200, burn_in = 50) frailty_compare(m1, m2, names = c("Gamma", "InvGauss"))data(kidney_frailty) m1 <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, frailty = "gamma", n_iter = 200, burn_in = 50) m2 <- frailty_bayes(Surv(time1, time2, status1, status2) ~ age, data = kidney_frailty, frailty = "invgauss", n_iter = 200, burn_in = 50) frailty_compare(m1, m2, names = c("Gamma", "InvGauss"))
Fits frailty survival regression models using either Bayesian MCMC or Maximum Likelihood Estimation.
frailty_fit(formula, data, engine = c("bayes", "mle"), ...)frailty_fit(formula, data, engine = c("bayes", "mle"), ...)
formula |
Formula expression for bivariate or univariate survival data. |
data |
Data frame. |
engine |
Estimation engine: |
... |
Arguments passed to |
A fitted model object of class "frailty_bayes" or "frailty_mle".
data(kidney_frailty) fit <- frailty_fit( Surv(time1, time2, status1, status2) ~ age + sex, data = kidney_frailty, engine = "mle", baseline = "weibull", frailty = "gamma" ) print(fit)data(kidney_frailty) fit <- frailty_fit( Surv(time1, time2, status1, status2) ~ age + sex, data = kidney_frailty, engine = "mle", baseline = "weibull", frailty = "gamma" ) print(fit)
Estimates shared, additive, multiplicative, and merged frailty models using maximum likelihood estimation with analytical/numerical Hessian.
frailty_mle( formula, data, baseline = c("weibull", "exponential", "genexponential", "exppower", "lfr", "genloglogistic", "genweibull", "genrayleigh", "weightedexp", "extendedweibull"), frailty = c("gamma", "invgauss", "posstable", "compoundpoisson", "compoundnb", "genlindley", "weightedlindley", "mixture_invgauss"), type = c("multiplicative_bivariate", "additive_bivariate", "multiplicative_univariate", "additive_univariate", "merged_univariate"), init = NULL, method = "BFGS", hessian = TRUE, ... )frailty_mle( formula, data, baseline = c("weibull", "exponential", "genexponential", "exppower", "lfr", "genloglogistic", "genweibull", "genrayleigh", "weightedexp", "extendedweibull"), frailty = c("gamma", "invgauss", "posstable", "compoundpoisson", "compoundnb", "genlindley", "weightedlindley", "mixture_invgauss"), type = c("multiplicative_bivariate", "additive_bivariate", "multiplicative_univariate", "additive_univariate", "merged_univariate"), init = NULL, method = "BFGS", hessian = TRUE, ... )
formula |
Formula expression for bivariate or univariate survival data. |
data |
Data frame containing survival data and covariates. |
baseline |
Baseline distribution name. |
frailty |
Frailty distribution name. |
type |
Model formulation type. |
init |
Initial parameter vector (optional). |
method |
Optimization method passed to |
hessian |
Logical; if |
... |
Additional arguments. |
An S3 object of class "frailty_mle".
data(kidney_frailty) fit_mle <- frailty_mle( Surv(time1, time2, status1, status2) ~ age + sex, data = kidney_frailty, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate" ) print(fit_mle) summary(fit_mle)data(kidney_frailty) fit_mle <- frailty_mle( Surv(time1, time2, status1, status2) ~ age + sex, data = kidney_frailty, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate" ) print(fit_mle) summary(fit_mle)
Generates the power set of components ,
representing all possible combinations of malfunctioned components.
generate_powerset(M)generate_powerset(M)
M |
An integer greater than or equal to 1 specifying the number of components. |
Missing values are not allowed for M. If M is not a positive integer,
an error is thrown.
A list of integer vectors, where each vector represents a subset of
malfunctioned component indices (from integer(0) for no failures to 1:M
for all failures).
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
generate_powerset(2) generate_powerset(3)generate_powerset(2) generate_powerset(3)
Computes the highest posterior density credible interval for a sample of MCMC draws.
hpd_interval(samples, prob = 0.95)hpd_interval(samples, prob = 0.95)
samples |
Numeric vector of MCMC posterior draws. |
prob |
Numeric scalar in |
Finds the shortest interval containing the specified probability mass prob from the sorted posterior draws.
Missing values (NA or NaN) in samples are automatically omitted.
A named numeric vector of length 2 containing:
lowerThe lower bound of the highest posterior density interval.
upperThe upper bound of the highest posterior density interval.
set.seed(123) draws <- stats::rnorm(1000, mean = 5, sd = 1) hpd_interval(draws, prob = 0.95)set.seed(123) draws <- stats::rnorm(1000, mean = 5, sd = 1) hpd_interval(draws, prob = 0.95)
A real-world dataset comprising retrospective times to insulin initiation for 390 pregnant women diagnosed with gestational diabetes mellitus (GDM) before 24 weeks of pregnancy, followed at the Hospital das Clinicas, University of Sao Paulo, Brazil.
insulin_gdminsulin_gdm
A data frame with 390 rows and 8 variables:
timeTime in weeks from the first obstetric visit to insulin initiation. Women initiating insulin within the first 7 days have time recorded as 0.
statusEvent indicator: 1 = insulin initiated during pregnancy, 0 = right-censored (cured/insulin-free throughout pregnancy).
family_diabetesFamily history of diabetes: 0 = No (n = 143), 1 = Yes (n = 247).
prior_gdmPrior history of gestational diabetes: 0 = Primigravida (n = 94), 1 = No prior GDM (n = 249), 2 = Yes (n = 47).
smokingSmoking history: 0 = Non-smoker (n = 356), 1 = Smoker (n = 34).
prior_macrosomiaPrior fetal macrosomia: 0 = No (n = 356), 1 = Yes (n = 34).
hypertensionPrior chronic hypertension: 0 = No (n = 282), 1 = Yes (n = 108).
bmi_catPre-pregnancy body mass index category: 0 = Normal (BMI <= 25, n = 84), 1 = Overweight (25 < BMI <= 30, n = 120), 2 = Obesity (BMI > 30, n = 186).
Assuncao, D., Ramos, P. L., Tomazella, V., Leao, J., Osses, L., and Rodrigues, A. (2026). Zero-Inflated Promotion Cure-Rate Models With Frailty and Flexible Activation Schemes. Biometrical Journal, 68:e70162. doi:10.1002/bimj.70162
Calsavara, V. F., Rodrigues, A. S., Rocha, R., Louzada, F., et al. (2019). Zero-Adjusted Defective Regression Models for Modeling Lifetime Data. Journal of Applied Statistics, 46(13), 2434-2459.
data(insulin_gdm) head(insulin_gdm) table(insulin_gdm$family_diabetes) table(insulin_gdm$prior_macrosomia) # Fit final selected model from paper with Random activation scheme fit_random <- ziprom_fit( formula_p0 = ~ prior_macrosomia, formula_p1 = ~ smoking + family_diabetes, time = insulin_gdm$time, status = insulin_gdm$status, data = insulin_gdm, activation = "random", frailty = FALSE ) summary(fit_random)data(insulin_gdm) head(insulin_gdm) table(insulin_gdm$family_diabetes) table(insulin_gdm$prior_macrosomia) # Fit final selected model from paper with Random activation scheme fit_random <- ziprom_fit( formula_p0 = ~ prior_macrosomia, formula_p1 = ~ smoking + family_diabetes, time = insulin_gdm$time, status = insulin_gdm$status, data = insulin_gdm, activation = "random", frailty = FALSE ) summary(fit_random)
Computes Kendall's rank correlation coefficient for the shared frailty model
under reversed hazard rate via numerical integration:
kendall_tau_rhr( frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )kendall_tau_rhr( frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )
frailty |
Character string indicating frailty distribution. |
theta |
Numeric parameter for frailty distribution. |
mu |
Optional secondary parameter for |
theta2 |
Optional second parameter for |
Numeric scalar representing Kendall's tau in [0, 1].
kendall_tau_rhr("WL", theta = 3.4) kendall_tau_rhr("Gamma", theta = 2.0)kendall_tau_rhr("WL", theta = 3.4) kendall_tau_rhr("Gamma", theta = 2.0)
Recurrence times of infection at the catheter insertion point for 38 kidney disease patients using portable dialysis machines, as studied in McGilchrist and Aisbett (1991), Pandey et al. (2022), and Tyagi et al. (2024).
kidney_bivariatekidney_bivariate
A data frame with 38 rows (one per patient) and 10 variables:
Patient identification number (1 to 38).
First infection recurrence time in days.
Censoring indicator for first recurrence (1 = infection occurred, 0 = censored).
Second infection recurrence time in days.
Censoring indicator for second recurrence (1 = infection occurred, 0 = censored).
Patient age in years.
Patient sex (0 = male, 1 = female).
Indicator for Glomerulonephritis kidney disease (1 = yes, 0 = no).
Indicator for Acute Nephritis kidney disease (1 = yes, 0 = no).
Indicator for Polycystic Kidney Disease (1 = yes, 0 = no).
McGilchrist, C. A., and Aisbett, C. W. (1991). Regression with frailty in survival analysis. Biometrics, 47(2), 461-466. doi:10.2307/2532138
Pandey, A., Hanagal, D. D., and Tyagi, S. (2022). Generalised Lindley shared additive frailty regression model for bivariate survival data. Statistics in Transition new series, 23(4), 161-176. doi:10.2478/stattrans-2022-0048
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
data(kidney_bivariate) head(kidney_bivariate) summary(kidney_bivariate)data(kidney_bivariate) head(kidney_bivariate) summary(kidney_bivariate)
Recurrence times to kidney catheter infection for 38 kidney patients (McGilchrist and Aisbett, 1991).
kidney_frailtykidney_frailty
A data frame with 38 rows and 8 variables:
Patient identification number (1 to 38).
Time to first catheter infection (days).
Time to second catheter infection (days).
Censoring indicator for first recurrence (1 = infection, 0 = censored).
Censoring indicator for second recurrence (1 = infection, 0 = censored).
Age of patient in years.
Gender of patient (1 = male, 0 = female).
Disease type (GN, AN, PKD, Other).
McGilchrist, C. A. and Aisbett, C. W. (1991). Regression with frailty in survival analysis. Biometrics, 47: 461-466.
Hanagal, D. D. and Dabade, A. D. (2013). A comparative study of shared frailty models for kidney infection data with generalized exponential baseline distribution. Journal of Data Science, 11(1): 109-142.
Recurrence times to catheter infection for 38 kidney dialysis patients from the classic study by McGilchrist and Aisbett (1991). Each patient has two recorded recurrence times (first and second insertion of catheter).
kidney_infectionkidney_infection
A data.frame with 38 rows (one per patient) and 9 variables:
Patient identification number (1 to 38).
Time to first catheter infection or censoring (in days).
Censoring indicator for first event (1 = infection, 0 = censored).
Time to second catheter infection or censoring (in days).
Censoring indicator for second event (1 = infection, 0 = censored).
Patient age in years.
Patient sex (1 = male, 2 = female).
Indicator for Glomerulonephritis disease type (1 = present, 0 = absent).
Indicator for Acute Nephritis disease type (1 = present, 0 = absent).
Indicator for Polycystic Kidney Disease (1 = present, 0 = absent).
McGilchrist, C. A. and Aisbett, C. W. (1991). Regression with frailty in survival analysis. Biometrics, 47(2), 461-466. <doi:10.2307/2532138>
Hanagal, D. D., Pandey, A., and Ganguly, A. (2017). Correlated gamma frailty models for bivariate survival data. Communications in Statistics - Simulation and Computation, 46(5), 3627-3644. <doi:10.1080/03610918.2015.1085559>
Hanagal, D. D. and Pandey, A. (2018). Correlated inverse Gaussian frailty models for bivariate survival data. Communications in Statistics - Theory and Methods, 49(14), 3455-3475. <doi:10.1080/03610926.2018.1549256>
data(kidney_infection) head(kidney_infection)data(kidney_infection) head(kidney_infection)
Computes the Laplace transform for various frailty distributions.
laplace_frailty( s, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )laplace_frailty( s, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )
s |
Numeric vector of non-negative arguments. |
frailty |
Character string indicating the frailty distribution. One of |
theta |
Numeric parameter for frailty distribution. |
mu |
Optional secondary parameter for |
theta2 |
Optional second parameter for |
Numeric vector of Laplace transform values.
laplace_frailty(c(0.1, 0.5, 1.0), frailty = "WL", theta = 3.4)laplace_frailty(c(0.1, 0.5, 1.0), frailty = "WL", theta = 3.4)
Evaluates the exact log-likelihood function under random right censoring for additive shared frailty regression models with Generalized Lindley, Weighted Lindley, Gamma, or Inverse Gaussian frailty, and Generalized Weibull or Generalized Log-Logistic Type-II baseline distributions.
loglik_add_frailty( params, t1, delta1, t2, delta2, X, frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), baseline_dist = c("gw", "gll2") )loglik_add_frailty( params, t1, delta1, t2, delta2, X, frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), baseline_dist = c("gw", "gll2") )
params |
Numeric vector of all model parameters:
|
t1 |
Numeric vector of first survival times (positive). |
delta1 |
Numeric vector of first censoring indicators (1 = event, 0 = censored). |
t2 |
Numeric vector of second survival times (positive). |
delta2 |
Numeric vector of second censoring indicators (1 = event, 0 = censored). |
X |
Covariate design matrix with |
frailty_type |
Character string specifying the frailty distribution:
|
baseline_dist |
Character string specifying baseline distribution:
|
A scalar numeric value representing the total log-likelihood.
Pandey, A., Hanagal, D. D., and Tyagi, S. (2022). Generalised Lindley shared additive frailty regression model for bivariate survival data. Statistics in Transition new series, 23(4), 161-176. doi:10.2478/stattrans-2022-0048
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
data(kidney_bivariate) X <- as.matrix(kidney_bivariate[, c("age", "sex", "gn", "an", "pkd")]) pars <- c(zeta1 = 2.0, delta1 = 0.05, xi1 = 0.7, zeta2 = 2.7, delta2 = 0.06, xi2 = 0.7, theta = 2.3, mu = 1.4, beta1 = -0.1, beta2 = -9.0, beta3 = 2.4, beta4 = 1.6, beta5 = -50.0) loglik_add_frailty(pars, kidney_bivariate$t1, kidney_bivariate$delta1, kidney_bivariate$t2, kidney_bivariate$delta2, X, frailty_type = "genlindley", baseline_dist = "gw")data(kidney_bivariate) X <- as.matrix(kidney_bivariate[, c("age", "sex", "gn", "an", "pkd")]) pars <- c(zeta1 = 2.0, delta1 = 0.05, xi1 = 0.7, zeta2 = 2.7, delta2 = 0.06, xi2 = 0.7, theta = 2.3, mu = 1.4, beta1 = -0.1, beta2 = -9.0, beta3 = 2.4, beta4 = 1.6, beta5 = -50.0) loglik_add_frailty(pars, kidney_bivariate$t1, kidney_bivariate$delta1, kidney_bivariate$t2, kidney_bivariate$delta2, X, frailty_type = "genlindley", baseline_dist = "gw")
Evaluates the log-likelihood function for bivariate survival data with left censoring and shared frailty based on reversed hazard rates.
loglik_biv_rhr( params, t1, t2, d1, d2, X = NULL, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), baseline = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), separate_baseline = TRUE )loglik_biv_rhr( params, t1, t2, d1, d2, X = NULL, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), baseline = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), separate_baseline = TRUE )
params |
Numeric vector of all model parameters (frailty parameters, baseline parameters for T1 and T2, and regression coefficients). |
t1 |
Numeric vector of first failure/censoring times. |
t2 |
Numeric vector of second failure/censoring times. |
d1 |
Numeric or integer vector of censoring indicators for first component (1 = observed, 0 = left-censored). |
d2 |
Numeric or integer vector of censoring indicators for second component (1 = observed, 0 = left-censored). |
X |
Numeric matrix of covariates. |
frailty |
Character string specifying frailty distribution. |
baseline |
Character string specifying baseline distribution. |
separate_baseline |
Logical indicating whether baseline parameters for T1 and T2 are estimated separately. Default is |
Numeric scalar representing total log-likelihood.
data(austrian_twin) params <- c(zeta1 = 12.4, delta1 = 0.11, zeta2 = 11.8, delta2 = 0.11, theta = 3.4, beta1 = 0.007, beta2 = -0.11, beta3 = 0.13) X <- as.matrix(austrian_twin[, c("age", "k2", "k3")]) loglik_biv_rhr(params, austrian_twin$t1, austrian_twin$t2, austrian_twin$d1, austrian_twin$d2, X = X, frailty = "WL", baseline = "GE")data(austrian_twin) params <- c(zeta1 = 12.4, delta1 = 0.11, zeta2 = 11.8, delta2 = 0.11, theta = 3.4, beta1 = 0.007, beta2 = -0.11, beta3 = 0.13) X <- as.matrix(austrian_twin[, c("age", "k2", "k3")]) loglik_biv_rhr(params, austrian_twin$t1, austrian_twin$t2, austrian_twin$d1, austrian_twin$d2, X = X, frailty = "WL", baseline = "GE")
Computes the log-likelihood of one-shot device testing data under the shared gamma frailty model with multiple failure modes.
loglik_oneshot( par, count_mat, X_cov, tau, M, baseline = c("weibull", "exponential"), frailty = TRUE, powerset = NULL )loglik_oneshot( par, count_mat, X_cov, tau, M, baseline = c("weibull", "exponential"), frailty = TRUE, powerset = NULL )
par |
Numeric vector of model parameters. |
count_mat |
An |
X_cov |
An |
tau |
A positive numeric vector of inspection times. |
M |
An integer specifying the number of components ( |
baseline |
A character string: |
frailty |
A logical value: |
powerset |
An optional list of power set subsets. |
Missing values are not permitted in count_mat, X_cov, tau, or par.
A numeric scalar representing the total log-likelihood.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
data(classH) X_cov <- cbind(1, classH$stress) tau <- classH$time count_mat <- as.matrix(classH[, c("n_none", "n_T", "n_G", "n_both")]) par <- c(-4.99, -0.005, -16.44, 0.018, 0.5) loglik_oneshot(par, count_mat, X_cov, tau, M = 2, baseline = "exponential", frailty = TRUE)data(classH) X_cov <- cbind(1, classH$stress) tau <- classH$time count_mat <- as.matrix(classH[, c("n_none", "n_T", "n_G", "n_both")]) par <- c(-4.99, -0.005, -16.44, 0.018, 0.5) loglik_oneshot(par, count_mat, X_cov, tau, M = 2, baseline = "exponential", frailty = TRUE)
Model Extraction Methods
## S3 method for class 'frailty_bayes' logLik(object, ...)## S3 method for class 'frailty_bayes' logLik(object, ...)
object |
Fitted frailty model object. |
... |
Additional arguments. |
The extracted model quantity.
Extracts the maximized log-likelihood value from a fitted "oneshot_kofm" object.
## S3 method for class 'oneshot_kofm' logLik(object, ...)## S3 method for class 'oneshot_kofm' logLik(object, ...)
object |
A fitted model object of class |
... |
Additional arguments. |
An object of class "logLik" with degrees of freedom attribute.
Log Pseudo Marginal Likelihood (LPML)
lpml(object)lpml(object)
object |
An object of class |
Numeric LPML scalar value.
Toxicological study data from the ED01 experiment on 671 mice across 6 test groups
(Table 12 of Ling et al., 2021), originally discussed by Lindsey and Ryan (1993).
Animals were exposed to 2-acetylaminofluorene (2-AAF) at control (0 ppm) or high dose
(150 ppm) and inspected at 12, 18, or 33 months for endpoints:
Bladder Tumor onset (T) and Death (D).
mice_tumormice_tumor
A data frame with 6 rows and 7 variables:
groupTest group index ().
doseCarcinogen 2-AAF dose level in ppm ().
timeSacrifice / inspection time in months ().
n_noneNumber of sacrificed mice without tumor ().
n_TNumber of sacrificed mice with bladder tumor ().
n_DNumber of dead mice without bladder tumor ().
n_bothNumber of dead mice with bladder tumor ().
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
Lindsey, J. C. and Ryan, L. M. (1993). A three-state multiplicative model for rodent tumorigenicity experiments. Journal of the Royal Statistical Society: Series C (Applied Statistics), 42(2), 283–300. doi:10.2307/2986234.
data(mice_tumor) head(mice_tumor)data(mice_tumor) head(mice_tumor)
Computes the Mean Time to Failure (MTTF) of -out-of- systems under shared gamma frailty.
mttf_k_out_of_m(object, ...)mttf_k_out_of_m(object, ...)
object |
A fitted model object of class |
... |
Additional arguments passed to methods. |
A data frame containing MTTF values across system configurations.
Calculates the Mean Time to Failure (MTTF) of -out-of- structured
one-shot devices by numerical integration of the system reliability function .
## S3 method for class 'oneshot_frailty' mttf_k_out_of_m(object, stress = NULL, k = NULL, upper_limit = 1e+05, ...)## S3 method for class 'oneshot_frailty' mttf_k_out_of_m(object, stress = NULL, k = NULL, upper_limit = 1e+05, ...)
object |
A fitted model object of class |
stress |
Optional numeric vector or matrix of stress covariate values. |
k |
Optional integer specifying system threshold (defaults to all |
upper_limit |
Upper limit of integration in time units (default 1e5). |
... |
Additional arguments passed to other methods. |
The MTTF of a -out-of- system is given by
evaluated using adaptive quadrature via stats::integrate.
A data frame containing:
System threshold .
Descriptive string (e.g. "Parallel (k=1)", "Series (k=M)", "k-out-of-M").
Computed Mean Time to Failure.
Yu, C., So, H. Y., and Balakrishnan, N. (2025). Inference for one-shot devices with Weibull component lifetimes under gamma frailty model. In: Stochastic Modeling and Statistical Methods, Elsevier Inc., Chapter 1, pp. 1–34. doi:10.1016/B978-0-44-331694-4.00006-2.
data(classH) start_par <- c(-3.997, -0.009, -14.412, 0.003, 0.004, -0.001, -5.493e-4, -0.005, 0.082) fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE, start = start_par ) mttf_k_out_of_m(fit_w, stress = 400, upper_limit = 50000)data(classH) start_par <- c(-3.997, -0.009, -14.412, 0.003, 0.004, -0.001, -5.493e-4, -0.005, 0.082) fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE, start = start_par ) mttf_k_out_of_m(fit_w, stress = 400, upper_limit = 50000)
Computes the exact analytical mean lifetime (Mean Time to Failure, MTTF)
of -out-of- structured one-shot devices under gamma frailty at normal
operating stress , standard errors via the delta method, and both Asymptotic
Confidence Intervals (ACI) and Log-Transformed Confidence Intervals (TCI).
## S3 method for class 'oneshot_kofm' mttf_k_out_of_m( object, stress, k = NULL, ci_level = 0.95, upper_limit = 1e+06, ... )## S3 method for class 'oneshot_kofm' mttf_k_out_of_m( object, stress, k = NULL, ci_level = 0.95, upper_limit = 1e+06, ... )
object |
A fitted model object of class |
stress |
A numeric scalar or vector representing the normal operating condition |
k |
An optional integer vector specifying system structures ( |
ci_level |
A numeric scalar between 0 and 1 specifying the confidence level (default 0.95). |
upper_limit |
Upper numerical integration limit for Weibull baseline (default 1e6). |
... |
Additional arguments passed to other methods. |
For Exponential baseline distributions under gamma frailty, the exact analytical
mean lifetime at stress level is given by Equation (4) of Ling et al. (2021):
The standard error is computed via the delta method:
where is the analytical gradient vector
(Section 5, Ling et al., 2021).
The Log-Transformed Confidence Interval (TCI) is:
ensuring strictly positive lower bounds.
Missing values are not permitted.
A data frame containing:
The system structure threshold (-out-of-).
Character description ("Parallel (k=1)", "Series (k=M)", or "k-out-of-M").
Operating stress level .
Estimated mean lifetime .
Standard error of mean lifetime from the delta method.
Lower bound of the Asymptotic Confidence Interval (ACI).
Upper bound of the Asymptotic Confidence Interval (ACI).
Lower bound of the Log-Transformed Confidence Interval (TCI).
Upper bound of the Log-Transformed Confidence Interval (TCI).
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
Balakrishnan, N. and Ling, M. H. (2014). Gamma lifetimes and one-shot device testing analysis. Reliability Engineering & System Safety, 126, 54–64. doi:10.1016/j.ress.2014.01.009.
data(classH) fit <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "exponential" ) # Mean lifetimes at normal operating condition s0 = 356 F mttf_k_out_of_m(fit, stress = 356)data(classH) fit <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "exponential" ) # Mean lifetimes at normal operating condition s0 = 356 F mttf_k_out_of_m(fit, stress = 356)
Fits the Weibull or Exponential shared gamma frailty model to one-shot device testing data with multiple failure modes under constant-stress accelerated life tests, computing maximum likelihood parameter estimates, standard errors, asymptotic confidence intervals, and model selection criteria.
oneshot_frailty( formula = NULL, data, time = "time", stress = "stress", counts = NULL, components = NULL, baseline = c("weibull", "exponential"), frailty = TRUE, method = c("mle", "em"), start = NULL, ci_level = 0.95, control = list(), ... )oneshot_frailty( formula = NULL, data, time = "time", stress = "stress", counts = NULL, components = NULL, baseline = c("weibull", "exponential"), frailty = TRUE, method = c("mle", "em"), start = NULL, ci_level = 0.95, control = list(), ... )
formula |
Optional formula of the form |
data |
A data frame containing the test group observations, covariates, inspection times, and malfunction subset counts. |
time |
A character string specifying the column name in |
stress |
An optional character vector of column names in |
counts |
An optional character vector of |
components |
An optional character vector of |
baseline |
A character string specifying the baseline lifetime distribution:
|
frailty |
A logical value: |
method |
A character string specifying the estimation algorithm: |
start |
An optional numeric vector of starting values for the parameters. |
ci_level |
A numeric scalar between 0 and 1 specifying the asymptotic confidence level (default 0.95). |
control |
An optional list of control parameters passed to the optimizer (e.g. |
... |
Additional arguments. |
The shared gamma frailty model links the component baseline hazard functions
with stress covariates via log-linear links
and .
Missing values are checked upon input; observations with missing values in required variables are rejected with an informative error message.
An S3 object of class "oneshot_frailty" containing:
A named numeric vector of maximum likelihood estimates.
The asymptotic variance-covariance matrix of the estimators.
A named numeric vector of standard errors.
A matrix with lower (LCI) and upper (UCI) asymptotic confidence bounds.
The maximized log-likelihood value.
The total number of estimated parameters.
Akaike Information Criterion ().
Bayesian Information Criterion ().
Corrected AIC for small sample sizes.
Hannan-Quinn Information Criterion.
Total number of devices tested across all groups.
An matrix of model-estimated cell probabilities.
An matrix of expected device counts.
An matrix of standardized Pearson residuals.
A list with the estimated Kendall's tau association (),
standard error, and confidence interval (if frailty = TRUE).
The number of components.
Character vector of component names.
Baseline distribution used ("weibull" or "exponential").
Logical flag indicating whether gamma frailty was modeled.
Estimation method used ("mle" or "em").
The processed input data frame.
The matched function call.
Yu, C., So, H. Y., and Balakrishnan, N. (2025). Inference for one-shot devices with Weibull component lifetimes under gamma frailty model. In: Stochastic Modeling and Statistical Methods, Elsevier Inc., Chapter 1, pp. 1–34. doi:10.1016/B978-0-44-331694-4.00006-2.
data(classH) # Fit shared gamma frailty model with Weibull baseline fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), components = c("Turn", "Ground"), baseline = "weibull", frailty = TRUE ) print(fit_w) summary(fit_w)data(classH) # Fit shared gamma frailty model with Weibull baseline fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), components = c("Turn", "Ground"), baseline = "weibull", frailty = TRUE ) print(fit_w) summary(fit_w)
Fits the shared gamma frailty model with Exponential or Weibull component lifetimes to one-shot device testing data with multiple failure modes under constant-stress accelerated life tests. Computes maximum likelihood parameter estimates, standard errors via the missing information principle, asymptotic confidence intervals, and information criteria.
oneshot_kofm( formula = NULL, data, time = "time", stress = "stress", counts = NULL, components = NULL, baseline = c("exponential", "weibull"), frailty = TRUE, method = c("em", "mle"), start = NULL, ci_level = 0.95, control = list(), ... )oneshot_kofm( formula = NULL, data, time = "time", stress = "stress", counts = NULL, components = NULL, baseline = c("exponential", "weibull"), frailty = TRUE, method = c("em", "mle"), start = NULL, ci_level = 0.95, control = list(), ... )
formula |
Optional formula of the form |
data |
A data frame containing the test group observations, covariates, inspection times, and malfunction subset counts. |
time |
A character string specifying the column name in |
stress |
An optional character vector of column names in |
counts |
An optional character vector of |
components |
An optional character vector of |
baseline |
A character string specifying the baseline lifetime distribution:
|
frailty |
A logical value: |
method |
A character string specifying the estimation algorithm: |
start |
An optional numeric vector of starting values for the parameters. |
ci_level |
A numeric scalar between 0 and 1 specifying the asymptotic confidence level (default 0.95). |
control |
An optional list of control parameters passed to the optimizer (e.g. |
... |
Additional arguments. |
The shared gamma frailty model links the component hazard rates
with stress covariates.
Missing values are checked upon input; observations with missing values in required variables are rejected with an informative error message.
An S3 object of class "oneshot_kofm" containing:
A named numeric vector of maximum likelihood estimates.
The asymptotic variance-covariance matrix of the estimators.
A named numeric vector of standard errors.
A matrix with lower (LCI) and upper (UCI) asymptotic confidence bounds.
The maximized log-likelihood value.
The total number of estimated parameters.
Akaike Information Criterion ().
Bayesian Information Criterion ().
Corrected AIC for small sample sizes.
Hannan-Quinn Information Criterion.
Total number of devices tested across all groups.
An matrix of model-estimated cell probabilities.
An matrix of expected device counts.
An matrix of standardized Pearson residuals.
A list with the estimated Kendall's tau association (),
standard error, and confidence interval (if frailty = TRUE).
The number of components.
Character vector of component names.
Baseline distribution used ("exponential" or "weibull").
Logical flag indicating whether gamma frailty was modeled.
Estimation method used ("em" or "mle").
The processed input data frame.
The matched function call.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
data(classH) # Fit shared gamma frailty model with Exponential baseline fit_exp <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), components = c("Turn", "Ground"), baseline = "exponential", frailty = TRUE, method = "em" ) print(fit_exp) summary(fit_exp)data(classH) # Fit shared gamma frailty model with Exponential baseline fit_exp <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), components = c("Turn", "Ground"), baseline = "exponential", frailty = TRUE, method = "em" ) print(fit_exp) summary(fit_exp)
Computes the cumulative distribution function (CDF) for baseline distributions under reversed hazard rate models.
p_rhr_baseline( t, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )p_rhr_baseline( t, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )
t |
Numeric vector of positive failure times. |
dist |
Character string specifying baseline distribution. One of |
params |
Numeric named vector of baseline parameters. |
Numeric vector of cumulative probabilities in (0, 1).
p_rhr_baseline(c(10, 20, 30), dist = "GE", params = c(zeta = 12.4, delta = 0.11))p_rhr_baseline(c(10, 20, 30), dist = "GE", params = c(zeta = 12.4, delta = 0.11))
Fits and compares the fitted population survival curves under Minimum, Maximum, and Random activation schemes for a given dataset.
plot_activation_compare(object, times = NULL, col = NULL, lwd = 2, ...)plot_activation_compare(object, times = NULL, col = NULL, lwd = 2, ...)
object |
An object of class |
times |
Optional numeric vector of evaluation times. |
col |
Colors for the three activation schemes. |
lwd |
Line width (default is 2). |
... |
Additional graphical parameters. |
Invisible list of fitted models for each activation scheme.
set.seed(42) sim_dat <- sim_ziprom(n = 60, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random") plot_activation_compare(fit)set.seed(42) sim_dat <- sim_ziprom(n = 60, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random") plot_activation_compare(fit)
Generates MCMC trace plots, autocorrelation (ACF) plots, posterior density plots, baseline hazard and survival curves, and goodness-of-fit diagnostic plots.
## S3 method for class 'add_frailty' plot( x, type = c("trace", "acf", "density", "survival", "hazard", "gof"), params = NULL, max_time = 100, ... )## S3 method for class 'add_frailty' plot( x, type = c("trace", "acf", "density", "survival", "hazard", "gof"), params = NULL, max_time = 100, ... )
x |
An object of class |
type |
Character string specifying plot type: |
params |
Optional character vector of parameter names to plot. If |
max_time |
Maximum time horizon for survival/hazard plots (default 100). |
... |
Additional graphical parameters passed to plotting functions. |
Invisible NULL. Produces base R graphics.
Pandey, A., Hanagal, D. D., and Tyagi, S. (2022). Generalised Lindley shared additive frailty regression model for bivariate survival data. Statistics in Transition new series, 23(4), 161-176. doi:10.2478/stattrans-2022-0048
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
data(kidney_bivariate) fit_mle <- fit_add_frailty_mle( data = kidney_bivariate, frailty_type = "wlindley", baseline_dist = "gw" ) plot(fit_mle, type = "survival") plot(fit_mle, type = "hazard")data(kidney_bivariate) fit_mle <- fit_add_frailty_mle( data = kidney_bivariate, frailty_type = "wlindley", baseline_dist = "gw" ) plot(fit_mle, type = "survival") plot(fit_mle, type = "hazard")
S3 Plot Method for Bayesian Frailty Models
## S3 method for class 'frailty_bayes' plot(x, which = c("trace", "density", "autocorr", "survival", "hazard"), ...)## S3 method for class 'frailty_bayes' plot(x, which = c("trace", "density", "autocorr", "survival", "hazard"), ...)
x |
An object of class |
which |
Character vector specifying plot types: |
... |
Additional graphical parameters. |
Invisibly returns NULL.
Produces trace plots, posterior density plots, autocorrelation plots, estimated survival curves, or estimated hazard rate functions.
Provides diagnostic visualization and reliability plotting for fitted
"oneshot_frailty" model objects.
## S3 method for class 'oneshot_frailty' plot( x, which = c("all", "reliability", "survival", "residuals", "fitted"), stress = NULL, t_max = NULL, ask = prod(graphics::par("mfcol")) < 2 && grDevices::dev.interactive(), ... )## S3 method for class 'oneshot_frailty' plot( x, which = c("all", "reliability", "survival", "residuals", "fitted"), stress = NULL, t_max = NULL, ask = prod(graphics::par("mfcol")) < 2 && grDevices::dev.interactive(), ... )
x |
A fitted object of class |
which |
A character string or integer specifying the plot type:
|
stress |
Optional numeric vector or value of stress covariate for reliability evaluation. |
t_max |
Optional maximum time for reliability curves (defaults to |
ask |
Logical: |
... |
Additional graphical parameters passed to |
The available plot types are:
"reliability"System reliability curves for (parallel),
(series), and intermediate -out-of- structures.
"survival"Marginal component survival curves .
"residuals"Standardized Pearson residuals vs. test group index.
"fitted"Observed vs. model-fitted device counts for each malfunction subset.
Invisible NULL. Produces base R graphical plots.
Yu, C., So, H. Y., and Balakrishnan, N. (2025). Inference for one-shot devices with Weibull component lifetimes under gamma frailty model. In: Stochastic Modeling and Statistical Methods, Elsevier Inc., Chapter 1, pp. 1–34. doi:10.1016/B978-0-44-331694-4.00006-2.
data(classH) start_par <- c(-3.997, -0.009, -14.412, 0.003, 0.004, -0.001, -5.493e-4, -0.005, 0.082) fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE, start = start_par ) plot(fit_w, which = "reliability", stress = 400)data(classH) start_par <- c(-3.997, -0.009, -14.412, 0.003, 0.004, -0.001, -5.493e-4, -0.005, 0.082) fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE, start = start_par ) plot(fit_w, which = "reliability", stress = 400)
Generates publication-ready diagnostic plots for fitted "oneshot_kofm" models,
including -out-of- system reliability curves, component marginal survival
curves, observed vs. fitted cell proportions, and standardized Pearson residuals.
## S3 method for class 'oneshot_kofm' plot( x, which = c("all", "reliability", "marginal", "fit", "residuals"), stress = NULL, t_max = NULL, col = NULL, lty = NULL, lwd = 2, ... )## S3 method for class 'oneshot_kofm' plot( x, which = c("all", "reliability", "marginal", "fit", "residuals"), stress = NULL, t_max = NULL, col = NULL, lty = NULL, lwd = 2, ... )
x |
A fitted model object of class |
which |
A character string or integer specifying the plot type:
|
stress |
A numeric scalar specifying the operating stress condition for reliability curves.
If |
t_max |
A positive numeric scalar specifying the maximum mission time for curves.
If |
col |
Optional vector of colors for curves. |
lty |
Optional vector of line types. |
lwd |
Line width (default 2). |
... |
Additional graphical parameters passed to plotting functions. |
No return value, called for plotting side effects.
Produces graphical diagnostics for fitted Bayesian shared frailty models, including trace plots, posterior density plots with HPD intervals, autocorrelation decay, Kolmogorov-Smirnov goodness-of-fit plots, conditional predictive ordinate (CPO) plots, and reversed hazard rate (RHR) curves.
## S3 method for class 'rhr_bayes_fit' plot( x, type = c("trace", "density", "autocorr", "ks", "cpo", "rhr"), params = NULL, ask = FALSE, ... )## S3 method for class 'rhr_bayes_fit' plot( x, type = c("trace", "density", "autocorr", "ks", "cpo", "rhr"), params = NULL, ask = FALSE, ... )
x |
An object of class |
type |
Character vector or string specifying plot type. One or more of:
|
params |
Optional character vector of parameter names to plot. |
ask |
Logical; if |
... |
Additional arguments passed to base plotting functions. |
Invisible NULL.
data(austrian_twin) fit <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "GE", n_iter = 40, burn_in = 10) plot(fit, type = "trace", params = "theta")data(austrian_twin) fit <- fit_rhr_frailty_bayes(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "GE", n_iter = 40, burn_in = 10) plot(fit, type = "trace", params = "theta")
Produces goodness-of-fit and reversed hazard curves for an MLE shared frailty model.
## S3 method for class 'rhr_mle_fit' plot(x, type = c("ks", "rhr"), ...)## S3 method for class 'rhr_mle_fit' plot(x, type = c("ks", "rhr"), ...)
x |
An object of class |
type |
Character string indicating plot type: |
... |
Additional arguments passed to plotting functions. |
Invisible NULL.
data(austrian_twin) fit <- fit_rhr_frailty_mle(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "GE") plot(fit, type = "ks")data(austrian_twin) fit <- fit_rhr_frailty_mle(cbind(t1, t2, d1, d2) ~ age, data = austrian_twin[1:30, ], frailty = "WL", baseline = "GE") plot(fit, type = "ks")
Provides rich visual diagnostics including fitted population and susceptible survival curves, multi-level significance forecast plots (90%, 95%, 99%), normal QQ-plots of randomized quantile residuals with simulated envelopes, residual index plots, hazard/density plots, and activation scheme comparisons.
## S3 method for class 'ziprom_fit' plot( x, which = c("survival", "forecast", "qq", "residuals", "hazard", "density", "activation_compare"), newdata = NULL, times = NULL, level = c(0.9, 0.95, 0.99), col = NULL, lty = NULL, lwd = 2, main = NULL, xlab = NULL, ylab = NULL, ask = FALSE, ... ) plot_survival_fit(x, ...) plot_forecast(x, ...) plot_quantile_residuals(x, ...)## S3 method for class 'ziprom_fit' plot( x, which = c("survival", "forecast", "qq", "residuals", "hazard", "density", "activation_compare"), newdata = NULL, times = NULL, level = c(0.9, 0.95, 0.99), col = NULL, lty = NULL, lwd = 2, main = NULL, xlab = NULL, ylab = NULL, ask = FALSE, ... ) plot_survival_fit(x, ...) plot_forecast(x, ...) plot_quantile_residuals(x, ...)
x |
An object of class |
which |
Character string specifying the plot type:
|
newdata |
Optional data frame containing covariate values for plotting. |
times |
Optional numeric vector of time points for plotting curves. |
level |
Numeric vector of confidence levels for forecast bands. Default is |
col |
Vector of colors used for curves and confidence bands. |
lty |
Vector of line types. |
lwd |
Line width (default |
main |
Custom title for the plot. |
xlab |
Custom x-axis label. |
ylab |
Custom y-axis label. |
ask |
Logical; if |
... |
Additional arguments passed to base graphics functions. |
Invisible NULL. The function is called for its graphical side effects.
Assuncao, D., Ramos, P. L., Tomazella, V., Leao, J., Osses, L., and Rodrigues, A. (2026). Zero-Inflated Promotion Cure-Rate Models With Frailty and Flexible Activation Schemes. Biometrical Journal, 68:e70162. doi:10.1002/bimj.70162
set.seed(42) sim_dat <- sim_ziprom(n = 60, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random") plot(fit, which = "survival") plot(fit, which = "forecast") plot(fit, which = "qq")set.seed(42) sim_dat <- sim_ziprom(n = 60, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random") plot(fit, which = "survival") plot(fit, which = "forecast") plot(fit, which = "qq")
Predicts survival probabilities, cumulative hazards, or frailty estimates.
## S3 method for class 'frailty_bayes' predict( object, newdata = NULL, times = NULL, type = c("survival", "cumhaz", "hazard"), ... )## S3 method for class 'frailty_bayes' predict( object, newdata = NULL, times = NULL, type = c("survival", "cumhaz", "hazard"), ... )
object |
Fitted model object. |
newdata |
New data frame. |
times |
Time points for evaluation. |
type |
Prediction type: |
... |
Additional arguments. |
A numeric vector or matrix of predictions.
Generates predictions of -out-of- system reliability or component failure rates
for new stress levels and time intervals from a fitted "oneshot_kofm" object.
## S3 method for class 'oneshot_kofm' predict( object, newdata = NULL, type = c("reliability", "mttf", "moments"), k = NULL, ... )## S3 method for class 'oneshot_kofm' predict( object, newdata = NULL, type = c("reliability", "mttf", "moments"), k = NULL, ... )
object |
A fitted model object of class |
newdata |
An optional data frame with new |
type |
A character string: |
k |
An optional integer vector specifying system structures. |
... |
Additional arguments passed to underlying prediction functions. |
A data frame of predictions.
Generates predicted survival probabilities, susceptible survival, cumulative hazard, hazard rates, probability density, zero/cure proportions, and future forecasts with 90%, 95%, and 99% confidence / significance intervals.
## S3 method for class 'ziprom_fit' predict( object, newdata = NULL, type = c("survival", "susceptible_survival", "hazard", "cumhazard", "density", "p0", "p1", "forecast", "quantile"), times = NULL, quantiles = c(0.25, 0.5, 0.75), level = c(0.9, 0.95, 0.99), ... )## S3 method for class 'ziprom_fit' predict( object, newdata = NULL, type = c("survival", "susceptible_survival", "hazard", "cumhazard", "density", "p0", "p1", "forecast", "quantile"), times = NULL, quantiles = c(0.25, 0.5, 0.75), level = c(0.9, 0.95, 0.99), ... )
object |
An object of class |
newdata |
Optional data frame containing covariate values for prediction. If omitted, predictions are made at the sample mean of the covariates. |
type |
Character string indicating the type of prediction:
|
times |
Numeric vector of future or evaluation time points.
If |
quantiles |
Numeric vector of quantile levels (in (0, 1)) for |
level |
Numeric vector of confidence levels for interval estimation.
Default is |
... |
Additional arguments. |
Depending on type:
For "survival", "susceptible_survival", "hazard", "cumhazard", "density":
A numeric matrix (or vector) of predictions with rows corresponding to observations in newdata
and columns to times.
For "p0" or "p1": A numeric vector of fitted probabilities.
For "quantile": A numeric matrix of estimated quantile survival times.
For "forecast": A comprehensive data frame containing time, survival,
se, lower_90, upper_90, lower_95, upper_95,
lower_99, and upper_99.
Assuncao, D., Ramos, P. L., Tomazella, V., Leao, J., Osses, L., and Rodrigues, A. (2026). Zero-Inflated Promotion Cure-Rate Models With Frailty and Flexible Activation Schemes. Biometrical Journal, 68:e70162. doi:10.1002/bimj.70162
set.seed(42) sim_dat <- sim_ziprom(n = 60, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random") fc <- predict(fit, type = "forecast", times = seq(0, 5, length.out = 10)) print(head(fc))set.seed(42) sim_dat <- sim_ziprom(n = 60, activation = "random") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random") fc <- predict(fit, type = "forecast", times = seq(0, 5, length.out = 10)) print(head(fc))
Print Methods for Frailty Models
## S3 method for class 'frailty_bayes' print(x, ...)## S3 method for class 'frailty_bayes' print(x, ...)
x |
An object of class |
... |
Additional arguments. |
The evaluated object x, invisibly.
Prints a concise summary of the fitted "oneshot_kofm" model object.
## S3 method for class 'oneshot_kofm' print(x, digits = 4, ...)## S3 method for class 'oneshot_kofm' print(x, digits = 4, ...)
x |
A fitted model object of class |
digits |
An integer specifying the number of significant digits (default 4). |
... |
Additional arguments. |
No return value, called for printing side effects.
Prints the summary table for class "summary.oneshot_kofm".
## S3 method for class 'summary.oneshot_kofm' print(x, digits = 4, ...)## S3 method for class 'summary.oneshot_kofm' print(x, digits = 4, ...)
x |
An object of class |
digits |
An integer specifying the number of significant digits (default 4). |
... |
Additional arguments. |
No return value, called for printing side effects.
Standard S3 methods for inspecting, summarizing, and extracting components from fitted zero-inflated promotion cure-rate models.
## S3 method for class 'ziprom_fit' print(x, digits = 4, ...) ## S3 method for class 'ziprom_fit' summary(object, level = 0.95, ...) ## S3 method for class 'summary.ziprom_fit' print(x, digits = 4, ...) ## S3 method for class 'ziprom_fit' coef(object, ...) ## S3 method for class 'ziprom_fit' vcov(object, ...) ## S3 method for class 'ziprom_fit' confint(object, parm, level = 0.95, ...) ## S3 method for class 'ziprom_fit' logLik(object, ...) ## S3 method for class 'ziprom_fit' AIC(object, ..., k = 2) ## S3 method for class 'ziprom_fit' BIC(object, ...) ## S3 method for class 'ziprom_fit' residuals( object, type = c("quantile", "cox-snell", "deviance", "response"), ... )## S3 method for class 'ziprom_fit' print(x, digits = 4, ...) ## S3 method for class 'ziprom_fit' summary(object, level = 0.95, ...) ## S3 method for class 'summary.ziprom_fit' print(x, digits = 4, ...) ## S3 method for class 'ziprom_fit' coef(object, ...) ## S3 method for class 'ziprom_fit' vcov(object, ...) ## S3 method for class 'ziprom_fit' confint(object, parm, level = 0.95, ...) ## S3 method for class 'ziprom_fit' logLik(object, ...) ## S3 method for class 'ziprom_fit' AIC(object, ..., k = 2) ## S3 method for class 'ziprom_fit' BIC(object, ...) ## S3 method for class 'ziprom_fit' residuals( object, type = c("quantile", "cox-snell", "deviance", "response"), ... )
x |
An object of class |
digits |
Integer indicating the number of decimal digits to print. Default is 4. |
... |
Additional arguments passed to or from other methods. |
object |
An object of class |
level |
Confidence level for intervals (e.g. 0.90, 0.95, 0.99). Default is 0.95. |
parm |
Optional vector of parameter names or indices for |
k |
Penalty parameter for |
type |
Character string indicating residual type: |
print.ziprom_fit: Invisible copy of the model object.
summary.ziprom_fit: A summary object of class "summary.ziprom_fit".
coef.ziprom_fit: Named vector of estimated model coefficients.
vcov.ziprom_fit: Asymptotic variance-covariance matrix.
confint.ziprom_fit: Matrix of confidence intervals.
logLik.ziprom_fit: Log-likelihood value with attributes df and nobs.
AIC.ziprom_fit: Akaike Information Criterion.
BIC.ziprom_fit: Bayesian Information Criterion.
residuals.ziprom_fit: Vector of residuals.
Computes quantiles for baseline distributions used in reversed hazard rate models.
q_rhr_baseline( p, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )q_rhr_baseline( p, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )
p |
Numeric vector of probabilities in (0, 1). |
dist |
Character string specifying baseline distribution. |
params |
Numeric named vector of baseline parameters. |
Numeric vector of quantiles.
q_rhr_baseline(c(0.1, 0.5, 0.9), dist = "GE", params = c(zeta = 12.4, delta = 0.11))q_rhr_baseline(c(0.1, 0.5, 0.9), dist = "GE", params = c(zeta = 12.4, delta = 0.11))
Computes the quantile survival time such that
for uniform probabilities .
quantile_proper( v, theta, alpha, shape, scale, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )quantile_proper( v, theta, alpha, shape, scale, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )
v |
Numeric vector of probabilities in (0, 1). |
theta |
Numeric vector or scalar representing the latent Poisson parameter (> 0). |
alpha |
Numeric scalar representing Gamma frailty variance (>= 0). |
shape |
Numeric vector or scalar representing baseline shape parameter(s) (> 0). |
scale |
Numeric vector or scalar representing baseline scale parameter(s) (> 0). |
activation |
Character string indicating the activation scheme:
|
baseline |
Character string indicating the baseline hazard distribution:
|
Numeric vector of quantile survival times for susceptible individuals.
Evaluates the exact system reliability function of -out-of-
structured one-shot devices under shared gamma frailty at specified operating times
and stress levels.
reliability_k_out_of_m(object, ...)reliability_k_out_of_m(object, ...)
object |
A fitted model object of class |
... |
Additional arguments passed to methods. |
A data frame containing mission times, stress levels, system thresholds ,
and evaluated system reliabilities.
Computes the system reliability at specified mission times
for -out-of- structured one-shot devices under shared gamma frailty
and Weibull or Exponential baseline lifetime distributions.
## S3 method for class 'oneshot_frailty' reliability_k_out_of_m(object, t, stress = NULL, k = NULL, ...)## S3 method for class 'oneshot_frailty' reliability_k_out_of_m(object, t, stress = NULL, k = NULL, ...)
object |
A fitted model object of class |
t |
A non-negative numeric vector of mission time points at which reliability is evaluated. |
stress |
An optional numeric vector or matrix of stress covariate values. |
k |
An integer specifying the system threshold (the system functions if at least |
... |
Additional arguments passed to other methods. |
For a -out-of- system, the system operates if at least
components survive. Using the inclusion-exclusion principle and the power set
, the unconditional system reliability is
where is the number of malfunctioned components.
Special cases include:
k = 1: Parallel system (functions if at least 1 component functions).
k = M: Series system (functions only if all components function).
Missing values are not permitted in t or stress.
A data frame containing:
Evaluation time point .
System threshold .
Computed system reliability .
Failure probability .
Yu, C., So, H. Y., and Balakrishnan, N. (2025). Inference for one-shot devices with Weibull component lifetimes under gamma frailty model. In: Stochastic Modeling and Statistical Methods, Elsevier Inc., Chapter 1, pp. 1–34. doi:10.1016/B978-0-44-331694-4.00006-2.
Ling, M. H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for one-shot devices with dependent k-out-of-M structured components under gamma frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
data(classH) start_par <- c(-3.997, -0.009, -14.412, 0.003, 0.004, -0.001, -5.493e-4, -0.005, 0.082) fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE, start = start_par ) # Reliability of 1-out-of-2 (parallel) and 2-out-of-2 (series) systems at 400 deg F reliability_k_out_of_m(fit_w, t = c(1000, 2000, 5000), stress = 400, k = 1) reliability_k_out_of_m(fit_w, t = c(1000, 2000, 5000), stress = 400, k = 2)data(classH) start_par <- c(-3.997, -0.009, -14.412, 0.003, 0.004, -0.001, -5.493e-4, -0.005, 0.082) fit_w <- oneshot_frailty( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE, start = start_par ) # Reliability of 1-out-of-2 (parallel) and 2-out-of-2 (series) systems at 400 deg F reliability_k_out_of_m(fit_w, t = c(1000, 2000, 5000), stress = 400, k = 1) reliability_k_out_of_m(fit_w, t = c(1000, 2000, 5000), stress = 400, k = 2)
Evaluates the exact system reliability function of -out-of-
structured one-shot devices under shared gamma frailty at specified operating times
and stress levels.
## S3 method for class 'oneshot_kofm' reliability_k_out_of_m(object, t, stress, k = NULL, ...)## S3 method for class 'oneshot_kofm' reliability_k_out_of_m(object, t, stress, k = NULL, ...)
object |
A fitted model object of class |
t |
A positive numeric vector of mission times |
stress |
A numeric vector or matrix specifying stress conditions. |
k |
An optional integer vector specifying system structures ( |
... |
Additional arguments passed to other methods. |
For a -out-of- system, at least components must function for the
device to work. Under gamma frailty, the system reliability is given by:
where is the set of all subsets of of size , and
.
Missing values are not permitted.
A data frame containing:
The system structure threshold (-out-of-).
Character description ("Parallel (k=1)", "Series (k=M)", or "k-out-of-M").
Mission time .
Operating stress level.
Model-estimated system reliability .
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
data(classH) fit <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "exponential" ) rel <- reliability_k_out_of_m(fit, t = c(1000, 2000, 5000), stress = 356) head(rel)data(classH) fit <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "exponential" ) rel <- reliability_k_out_of_m(fit, t = c(1000, 2000, 5000), stress = 356) head(rel)
Computes Cox-Snell, Martingale, or deviance residuals.
## S3 method for class 'frailty_bayes' residuals(object, type = c("cox-snell", "martingale", "deviance"), ...)## S3 method for class 'frailty_bayes' residuals(object, type = c("cox-snell", "martingale", "deviance"), ...)
object |
Fitted frailty model object. |
type |
Type of residual: |
... |
Additional arguments. |
A numeric vector or matrix of residuals.
Extracts standardized Pearson residuals from a fitted "oneshot_kofm" object.
## S3 method for class 'oneshot_kofm' residuals(object, type = c("pearson"), ...)## S3 method for class 'oneshot_kofm' residuals(object, type = c("pearson"), ...)
object |
A fitted model object of class |
type |
A character string: |
... |
Additional arguments. |
A numeric matrix of standardized Pearson residuals.
Bivariate survival times to vision loss in 197 diabetic patients with paired eyes.
retinopathy_frailtyretinopathy_frailty
A data frame with 197 rows and 9 variables:
Patient identifier.
Time to visual acuity loss for eye 1.
Time to visual acuity loss for eye 2.
Status indicator for eye 1 (1 = blindness, 0 = censored).
Status indicator for eye 2 (1 = blindness, 0 = censored).
Laser treatment type (1 = Xenon, 0 = Argon).
Age at diabetes diagnosis in years.
Risk group indicator.
Treatment status (0 = control eye, 1 = treated eye).
Huster, W. J., Brookmeyer, R. and Self, S. G. (1989). Modelling paired survival data with covariates. Biometrics, 45: 145-156.
Computes the reversed hazard rate (RHR), defined as .
rhr_baseline( t, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )rhr_baseline( t, dist = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), params )
t |
Numeric vector of positive failure times. |
dist |
Character string specifying baseline distribution. |
params |
Numeric named vector of baseline parameters. |
Numeric vector of reversed hazard rate values.
rhr_baseline(c(10, 20, 30), dist = "GE", params = c(zeta = 12.4, delta = 0.11))rhr_baseline(c(10, 20, 30), dist = "GE", params = c(zeta = 12.4, delta = 0.11))
Alias and wrapper around sim_ziprom for generating synthetic survival data.
rzicr_promotion(n = 250, ...)rzicr_promotion(n = 250, ...)
n |
Sample size (integer > 0). Default is 250. |
... |
Additional arguments passed to |
A data frame of simulated observations.
set.seed(42) d <- rzicr_promotion(n = 50, activation = "minimum") head(d)set.seed(42) d <- rzicr_promotion(n = 50, activation = "minimum") head(d)
Generates synthetic bivariate survival data with random right censoring according to the additive shared frailty model specifications described in Pandey et al. (2022) and Tyagi et al. (2024).
sim_add_frailty( n = 50, beta = 0.15, X = NULL, frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), baseline_dist = c("gw", "gll2"), frailty_params = NULL, baseline_params1 = NULL, baseline_params2 = NULL, censor_type = c("exponential", "gamma"), censor_param = 0.1, seed = NULL )sim_add_frailty( n = 50, beta = 0.15, X = NULL, frailty_type = c("genlindley", "wlindley", "gamma", "invgaussian"), baseline_dist = c("gw", "gll2"), frailty_params = NULL, baseline_params1 = NULL, baseline_params2 = NULL, censor_type = c("exponential", "gamma"), censor_param = 0.1, seed = NULL )
n |
Number of bivariate observations (subjects/clusters) to generate. |
beta |
Numeric vector of regression coefficients (e.g. |
X |
Optional covariate matrix of dimensions |
frailty_type |
Character string specifying the frailty distribution:
|
baseline_dist |
Character string specifying the baseline distribution:
|
frailty_params |
Named or unnamed numeric vector of frailty parameters:
|
baseline_params1 |
Numeric vector of baseline parameters |
baseline_params2 |
Numeric vector of baseline parameters |
censor_type |
Character string specifying censoring distribution:
|
censor_param |
Numeric parameter for censoring distribution (rate for exponential; rate for gamma). |
seed |
Optional integer random seed for reproducibility. |
A data frame containing:
Subject identifier (1 to n).
Observed survival time for component 1.
Censoring indicator for component 1 (1 = event, 0 = censored).
Observed survival time for component 2.
Censoring indicator for component 2 (1 = event, 0 = censored).
Generated true frailty values.
Covariate columns.
Pandey, A., Hanagal, D. D., and Tyagi, S. (2022). Generalised Lindley shared additive frailty regression model for bivariate survival data. Statistics in Transition new series, 23(4), 161-176. doi:10.2478/stattrans-2022-0048
Tyagi, S., Pandey, A., Hanagal, D. D., and Chesneau, C. (2024). A study on comparisons of additive regression frailty models to counter heterogeneity: Bayesian strategies and case study. Communications in Statistics - Simulation and Computation. doi:10.1080/03610918.2024.2391874
# Simulate 50 observations from Generalized Lindley + GW additive frailty model sim_data <- sim_add_frailty(n = 50, beta = 0.15, frailty_type = "genlindley", baseline_dist = "gw", frailty_params = c(theta = 2.8, mu = 1.5), baseline_params1 = c(zeta = 22.5, delta = 0.013, xi = 0.35), baseline_params2 = c(zeta = 22.5, delta = 0.013, xi = 0.33), seed = 42) head(sim_data)# Simulate 50 observations from Generalized Lindley + GW additive frailty model sim_data <- sim_add_frailty(n = 50, beta = 0.15, frailty_type = "genlindley", baseline_dist = "gw", frailty_params = c(theta = 2.8, mu = 1.5), baseline_params1 = c(zeta = 22.5, delta = 0.013, xi = 0.35), baseline_params2 = c(zeta = 22.5, delta = 0.013, xi = 0.33), seed = 42) head(sim_data)
Generates synthetic bivariate left-censored survival data with covariates and shared frailty based on reversed hazard rates.
sim_biv_rhr_frailty( n = 100, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), baseline = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), theta = 3.4, mu = NULL, theta2 = NULL, params1 = c(zeta = 12.4, delta = 0.11), params2 = c(zeta = 11.8, delta = 0.11), beta = c(0.0075, -0.11, 0.13), covars = NULL, censor_time1 = 11, censor_time2 = 11, seed = NULL )sim_biv_rhr_frailty( n = 100, frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), baseline = c("GE", "EG", "GIR", "MIW", "GLL-I", "GLL-II", "GIE", "Weibull", "Exponential", "Log-Logistic"), theta = 3.4, mu = NULL, theta2 = NULL, params1 = c(zeta = 12.4, delta = 0.11), params2 = c(zeta = 11.8, delta = 0.11), beta = c(0.0075, -0.11, 0.13), covars = NULL, censor_time1 = 11, censor_time2 = 11, seed = NULL )
n |
Sample size (number of pairs). Default is |
frailty |
Character string specifying frailty distribution. Default is |
baseline |
Character string specifying baseline distribution. Default is |
theta |
Numeric parameter for frailty distribution. Default is |
mu |
Optional secondary parameter for |
theta2 |
Optional second parameter for |
params1 |
Numeric named vector of baseline parameters for first component. Default is |
params2 |
Numeric named vector of baseline parameters for second component. Default is |
beta |
Numeric vector of regression coefficients. Default is |
covars |
Optional numeric matrix of covariates of dimension |
censor_time1 |
Numeric scalar or vector of left-censoring thresholds for T1. Default is |
censor_time2 |
Numeric scalar or vector of left-censoring thresholds for T2. Default is |
seed |
Optional integer seed for reproducibility. Default is |
Simulates the latent frailty variable from the specified frailty distribution,
then generates conditionally independent lifetimes via probability integral transforms on conditional baseline reversed hazard distributions:
Left-censoring is applied such that if , the recorded time is and ; otherwise .
Missing values (NA or NaN) are not generated.
A data frame containing simulated columns:
t1Observed or left-censored lifetime for component 1.
t2Observed or left-censored lifetime for component 2.
d1Censoring indicator for component 1 (1 = observed, 0 = left-censored).
d2Censoring indicator for component 2 (1 = observed, 0 = left-censored).
Columns corresponding to the generated or supplied covariates.
frailty_wThe unobserved latent frailty value .
sim_data <- sim_biv_rhr_frailty(n = 50, frailty = "WL", baseline = "GE", seed = 123) head(sim_data)sim_data <- sim_biv_rhr_frailty(n = 50, frailty = "WL", baseline = "GE", seed = 123) head(sim_data)
Implements the conditional sampling algorithm using the Clayton survival copula (Equations 16–17 of Ling et al., 2021) to generate correlated component failure times under Lomax distributions.
sim_copula(n, lambda, beta, seed = NULL)sim_copula(n, lambda, beta, seed = NULL)
n |
An integer specifying the number of devices to generate. |
lambda |
A positive numeric vector of failure rates |
beta |
A positive numeric scalar representing the frailty variance / copula dependence parameter ( |
seed |
An optional integer for reproducibility. |
The algorithm generates and successively computes:
and component failure times .
Missing values are not permitted.
An numeric matrix of simulated component failure times,
where each row represents a device and each column represents a component.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
lam <- c(0.0086, 0.0067, 0.0052, 0.0024) sim_times <- sim_copula(n = 100, lambda = lam, beta = 0.3, seed = 123) head(sim_times)lam <- c(0.0086, 0.0067, 0.0052, 0.0024) sim_times <- sim_copula(n = 100, lambda = lam, beta = 0.3, seed = 123) head(sim_times)
Generates synthetic bivariate right-censored survival data from correlated frailty models with user-specified frailty families, baseline distributions, regression coefficients, and censoring rates.
sim_corrFrailty( n = 100, frailty = c("gamma", "invgaussian", "posstable", "comppoisson", "none"), frailty.params = list(sigma = 0.5, rho = 0.5), baseline = c("genweibull", "genloglogistic", "weibull", "exponential", "pareto", "lfr", "burr"), baseline.params = list(lambda = 0.05, gamma = 1.2), beta = c(0.5, -0.3), censor.rate = 0.2, seed = NULL )sim_corrFrailty( n = 100, frailty = c("gamma", "invgaussian", "posstable", "comppoisson", "none"), frailty.params = list(sigma = 0.5, rho = 0.5), baseline = c("genweibull", "genloglogistic", "weibull", "exponential", "pareto", "lfr", "burr"), baseline.params = list(lambda = 0.05, gamma = 1.2), beta = c(0.5, -0.3), censor.rate = 0.2, seed = NULL )
n |
Integer, sample size (number of pairs/clusters). Default is 100. |
frailty |
Character, frailty distribution. One of |
frailty.params |
List of frailty parameters. E.g., for |
baseline |
Character, baseline distribution for T1 and T2. One of
|
baseline.params |
List of baseline parameters. E.g., for |
beta |
Numeric vector of regression coefficients. Default is |
censor.rate |
Numeric between 0 and 1, target censoring proportion. Default is 0.2. |
seed |
Optional integer for reproducibility. |
A data.frame containing:
id |
Integer cluster / pair identifier (1 to n). |
t1 |
Observed time for first component. |
d1 |
Censoring indicator for first component (1 = event, 0 = censored). |
t2 |
Observed time for second component. |
d2 |
Censoring indicator for second component (1 = event, 0 = censored). |
x1, x2, ...
|
Simulated covariates. |
Shikhar Tyagi, Arvind Pandey, Vrijesh Tripathi
Hanagal, D. D., Pandey, A., and Ganguly, A. (2017). Correlated gamma frailty models for bivariate survival data. Communications in Statistics - Simulation and Computation, 46(5), 3627-3644. <doi:10.1080/03610918.2015.1085559>
Hanagal, D. D. and Pandey, A. (2018). Correlated inverse Gaussian frailty models for bivariate survival data. Communications in Statistics - Theory and Methods, 49(14), 3455-3475. <doi:10.1080/03610926.2018.1549256>
dat <- sim_corrFrailty(n = 50, frailty = "gamma", frailty.params = list(sigma = 0.5, rho = 0.4), baseline = "weibull", baseline.params = list(lambda = 0.05, gamma = 1.2), beta = c(0.4, -0.3), seed = 123) head(dat)dat <- sim_corrFrailty(n = 50, frailty = "gamma", frailty.params = list(sigma = 0.5, rho = 0.4), baseline = "weibull", baseline.params = list(lambda = 0.05, gamma = 1.2), beta = c(0.4, -0.3), seed = 123) head(dat)
A simulated one-shot device testing dataset with failure modes across
6 test groups (Table 15 of Ling et al., 2021). Evaluated at three stress levels
() and two inspection times () with
devices per group.
sim_data4sim_data4
A data frame with 6 rows and 19 variables:
groupTest group index ().
stressAccelerated stress level ().
timeInspection time ().
n_noneNumber of devices with no malfunction ().
n_1Devices with only Component 1 failed.
n_2Devices with only Component 2 failed.
n_3Devices with only Component 3 failed.
n_4Devices with only Component 4 failed.
n_12Devices with Components 1 and 2 failed.
n_13Devices with Components 1 and 3 failed.
n_14Devices with Components 1 and 4 failed.
n_23Devices with Components 2 and 3 failed.
n_24Devices with Components 2 and 4 failed.
n_34Devices with Components 3 and 4 failed.
n_123Devices with Components 1, 2, and 3 failed.
n_124Devices with Components 1, 2, and 4 failed.
n_134Devices with Components 1, 3, and 4 failed.
n_234Devices with Components 2, 3, and 4 failed.
n_allDevices with all 4 components failed ().
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
data(sim_data4) head(sim_data4)data(sim_data4) head(sim_data4)
Simulates synthetic survival datasets under shared, additive, or multiplicative frailty models, or simulates correlated component lifetimes for one-shot devices under shared gamma frailty.
sim_frailty( n = 100, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate", beta = c(0.5, -0.5), theta = 1, baseline_params = c(0.01, 1.2), censor_rate = 0.2, lambda = NULL, alpha = NULL, seed = NULL )sim_frailty( n = 100, baseline = "weibull", frailty = "gamma", type = "multiplicative_bivariate", beta = c(0.5, -0.5), theta = 1, baseline_params = c(0.01, 1.2), censor_rate = 0.2, lambda = NULL, alpha = NULL, seed = NULL )
n |
An integer specifying sample size (number of subjects, clusters, or devices). Default is 100. |
baseline |
Baseline hazard distribution name: |
frailty |
Frailty distribution name: |
type |
Model type: |
beta |
Regression coefficients vector or frailty variance parameter (for one-shot devices). |
theta |
Frailty parameter(s). |
baseline_params |
Baseline hazard parameter vector. |
censor_rate |
Proportion of right-censored observations (default 0.2). |
lambda |
Optional positive numeric vector of component failure rates |
alpha |
Optional positive numeric vector of Weibull shape parameters (for one-shot devices). |
seed |
Optional integer for reproducibility. |
If lambda is supplied, an numeric matrix of simulated
one-shot component lifetimes. Otherwise, a data frame containing simulated survival times,
status indicators, covariates, and true frailty values. Missing values are not generated.
# Simulate survival data sim_dat <- sim_frailty(n = 50, baseline = "weibull", frailty = "gamma") head(sim_dat) # Simulate one-shot device lifetimes lam <- c(0.0086, 0.0067, 0.0052, 0.0024) sim_times <- sim_frailty(n = 50, lambda = lam, beta = 0.3, seed = 123) head(sim_times)# Simulate survival data sim_dat <- sim_frailty(n = 50, baseline = "weibull", frailty = "gamma") head(sim_dat) # Simulate one-shot device lifetimes lam <- c(0.0086, 0.0067, 0.0052, 0.0024) sim_times <- sim_frailty(n = 50, lambda = lam, beta = 0.3, seed = 123) head(sim_times)
Generates synthetic one-shot device testing data frames across multiple test groups under constant-stress accelerated life-testing plans with dependent components.
sim_oneshot( n_groups = 4, K = 50, inspection_times = c(1000, 2000, 3000, 4000), stress_levels = c(25, 35, 45, 55), a_params, b_params = NULL, beta = 0.2, baseline = c("exponential", "weibull"), method = c("frailty", "copula"), seed = NULL )sim_oneshot( n_groups = 4, K = 50, inspection_times = c(1000, 2000, 3000, 4000), stress_levels = c(25, 35, 45, 55), a_params, b_params = NULL, beta = 0.2, baseline = c("exponential", "weibull"), method = c("frailty", "copula"), seed = NULL )
n_groups |
An integer specifying the number of test groups |
K |
An integer scalar or vector of length |
inspection_times |
A positive numeric vector of inspection times |
stress_levels |
A numeric vector or matrix of stress levels |
a_params |
An |
b_params |
An optional |
beta |
A positive numeric scalar representing the frailty variance ( |
baseline |
A character string: |
method |
A character string: |
seed |
An optional integer for reproducibility. |
Missing values are not permitted in any arguments.
A data frame containing:
Test group index .
Stress level .
Inspection time .
Observed counts for each of the malfunction combinations.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
a_par <- matrix(c(-6.0, 0.05, -6.5, 0.06), nrow = 2, byrow = TRUE) sim_df <- sim_oneshot( n_groups = 4, K = 50, inspection_times = c(10, 20, 10, 20), stress_levels = c(35, 35, 45, 45), a_params = a_par, beta = 0.2, seed = 42 ) head(sim_df)a_par <- matrix(c(-6.0, 0.05, -6.5, 0.06), nrow = 2, byrow = TRUE) sim_df <- sim_oneshot( n_groups = 4, K = 50, inspection_times = c(10, 20, 10, 20), stress_levels = c(35, 35, 45, 45), a_params = a_par, beta = 0.2, seed = 42 ) head(sim_df)
Convenience alias to generate correlated component lifetimes for one-shot devices under gamma frailty.
sim_oneshot_frailty(n, lambda, beta, alpha = NULL, seed = NULL)sim_oneshot_frailty(n, lambda, beta, alpha = NULL, seed = NULL)
n |
An integer specifying the number of devices to generate. |
lambda |
A positive numeric vector of failure rates |
beta |
A positive numeric scalar representing the frailty variance ( |
alpha |
An optional positive numeric vector of Weibull shape parameters. |
seed |
An optional integer for reproducibility. |
An numeric matrix of simulated component failure times. Missing values are not permitted.
Generates correlated component lifetimes by first generating a latent gamma frailty
and then simulating conditionally
independent Exponential or Weibull component lifetimes.
sim_oneshot_frailty_lifetimes(n, lambda, beta, alpha = NULL, seed = NULL)sim_oneshot_frailty_lifetimes(n, lambda, beta, alpha = NULL, seed = NULL)
n |
An integer specifying the number of devices to generate. |
lambda |
A positive numeric vector of failure rates |
beta |
A positive numeric scalar representing the frailty variance ( |
alpha |
An optional positive numeric vector of Weibull shape parameters (default 1 for exponential). |
seed |
An optional integer for reproducibility. |
Conditioned on ,
the component lifetimes are independent with:
where .
Missing values are not permitted.
An numeric matrix of simulated component failure times.
Ling, M.-H., Balakrishnan, N., Yu, C., and So, H. Y. (2021). Inference for One-Shot Devices with Dependent k-Out-of-M Structured Components under Gamma Frailty. Mathematics, 9(23), 3032. doi:10.3390/math9233032.
lam <- c(0.0086, 0.0067, 0.0052, 0.0024) sim_times <- sim_frailty(n = 100, lambda = lam, beta = 0.3, seed = 123) head(sim_times)lam <- c(0.0086, 0.0067, 0.0052, 0.0024) sim_times <- sim_frailty(n = 100, lambda = lam, beta = 0.3, seed = 123) head(sim_times)
Generates synthetic survival datasets under the zero-adjusted promotion cure-rate model with Gamma frailty and flexible activation schemes (Algorithm 1 of Assuncao et al., 2026).
sim_ziprom( n = 250, beta1 = c(-2, 0.5), beta2 = c(-1, 0.75), beta3 = c(0.5, 0.5), beta4 = c(1.5, 2), alpha = 0.25, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential"), censor_rate = 0.2, seed = NULL )sim_ziprom( n = 250, beta1 = c(-2, 0.5), beta2 = c(-1, 0.75), beta3 = c(0.5, 0.5), beta4 = c(1.5, 2), alpha = 0.25, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential"), censor_rate = 0.2, seed = NULL )
n |
Sample size (integer > 0). Default is 250. |
beta1 |
Numeric vector of coefficients for zero-inflation linear predictor |
beta2 |
Numeric vector of coefficients for cure fraction linear predictor |
beta3 |
Numeric vector of coefficients for shape linear predictor |
beta4 |
Numeric vector of coefficients for scale linear predictor |
alpha |
Numeric scalar for Gamma frailty variance ( |
activation |
Character string for activation scheme: |
baseline |
Character string for baseline activation distribution: |
censor_rate |
Nominal right-censoring rate in (0, 1). Default is 0.20. |
seed |
Optional integer random seed for reproducibility. |
A data frame containing:
timeObserved survival times ().
statusCensoring indicator (1 = event, 0 = right-censored).
xSimulated binary covariate ().
Assuncao, D., Ramos, P. L., Tomazella, V., Leao, J., Osses, L., and Rodrigues, A. (2026). Zero-Inflated Promotion Cure-Rate Models With Frailty and Flexible Activation Schemes. Biometrical Journal, 68:e70162. doi:10.1002/bimj.70162
set.seed(123) dat <- sim_ziprom(n = 100, activation = "random") head(dat) table(dat$time == 0) # Instantaneous zero failures table(dat$status) # Events vs censoredset.seed(123) dat <- sim_ziprom(n = 100, activation = "random") head(dat) table(dat$time == 0) # Instantaneous zero failures table(dat$status) # Events vs censored
Summary Method for Bayesian Frailty Models
## S3 method for class 'frailty_bayes' summary(object, ...)## S3 method for class 'frailty_bayes' summary(object, ...)
object |
Object of class |
... |
Additional arguments. |
An object of class "summary.frailty_bayes".
Summary Method for MLE Frailty Models
## S3 method for class 'frailty_mle' summary(object, ...)## S3 method for class 'frailty_mle' summary(object, ...)
object |
Object of class |
... |
Additional arguments. |
An object of class "summary.frailty_mle".
Computes and formats comprehensive estimation summaries, standard errors,
-values, -values, and confidence intervals for "oneshot_kofm" objects.
## S3 method for class 'oneshot_kofm' summary(object, ci_level = object$ci_level, ...)## S3 method for class 'oneshot_kofm' summary(object, ci_level = object$ci_level, ...)
object |
A fitted model object of class |
ci_level |
A numeric scalar between 0 and 1 specifying the confidence level (default from object). |
... |
Additional arguments. |
An S3 object of class "summary.oneshot_kofm" containing formatted tables
and model evaluation statistics.
Computes under Minimum, Maximum,
and Random activation schemes with Gamma frailty.
surv_proper( t, theta, alpha, shape, scale, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )surv_proper( t, theta, alpha, shape, scale, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )
t |
Numeric vector of positive survival times. |
theta |
Numeric vector or scalar representing the latent Poisson parameter (> 0). |
alpha |
Numeric scalar representing Gamma frailty variance (>= 0). |
shape |
Numeric vector or scalar representing baseline shape parameter(s) (> 0). |
scale |
Numeric vector or scalar representing baseline scale parameter(s) (> 0). |
activation |
Character string indicating the activation scheme:
|
baseline |
Character string indicating the baseline hazard distribution:
|
Numeric vector of proper conditional survival probabilities.
Performs the Likelihood Ratio Test comparing Weibull versus Exponential baseline lifetime distributions.
test_baseline(object, ...)test_baseline(object, ...)
object |
A fitted Weibull model object of class |
... |
Additional arguments passed to methods (such as |
An S3 object of class "htest" containing the test statistic, degrees of freedom, and p-value.
data(classH) fit_w <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE ) test_baseline(fit_w)data(classH) fit_w <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "weibull", frailty = TRUE ) test_baseline(fit_w)
Performs the Likelihood Ratio Test (LRT) to evaluate the null hypothesis of component independence against the shared gamma frailty alternative.
test_independence(object, ...)test_independence(object, ...)
object |
A fitted model object of class |
... |
Additional arguments passed to methods (such as |
An S3 object of class "htest" containing the test statistic, degrees of freedom, and p-value.
data(classH) fit_w <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "exponential", frailty = TRUE ) test_independence(fit_w)data(classH) fit_w <- oneshot_kofm( data = classH, time = "time", stress = "stress", counts = c("n_none", "n_T", "n_G", "n_both"), baseline = "exponential", frailty = TRUE ) test_independence(fit_w)
Computes the theoretical variance of the frailty distribution under the identifiability condition .
var_frailty( frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )var_frailty( frailty = c("WL", "GL", "GIG", "Gamma", "IG", "Lindley", "None"), theta, mu = NULL, theta2 = NULL )
frailty |
Character string indicating frailty distribution. |
theta |
Numeric parameter for frailty distribution. |
mu |
Optional secondary parameter for |
theta2 |
Optional second parameter for |
Numeric scalar representing variance of frailty variable.
var_frailty("WL", theta = 3.4) var_frailty("Gamma", theta = 2.0)var_frailty("WL", theta = 3.4) var_frailty("Gamma", theta = 2.0)
Extracts the asymptotic variance-covariance matrix of parameter estimators
from a fitted "oneshot_kofm" object.
## S3 method for class 'oneshot_kofm' vcov(object, ...)## S3 method for class 'oneshot_kofm' vcov(object, ...)
object |
A fitted model object of class |
... |
Additional arguments. |
A symmetric numeric variance-covariance matrix.
Computes the population density function for positive survival times .
ziprom_core_dens( t, p0, p1, alpha = 0, shape = 1, scale = 1, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )ziprom_core_dens( t, p0, p1, alpha = 0, shape = 1, scale = 1, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )
t |
Numeric vector of positive times ( |
p0 |
Numeric vector or scalar of zero-failure probabilities. |
p1 |
Numeric vector or scalar of cure fractions. |
alpha |
Numeric scalar representing Gamma frailty variance (>= 0). |
shape |
Numeric vector or scalar for shape parameter. |
scale |
Numeric vector or scalar for scale parameter. |
activation |
Character string for activation scheme ( |
baseline |
Character string for baseline hazard distribution ( |
Numeric vector of population density values for .
t_seq <- seq(0.1, 10, by = 1) d_vals <- ziprom_core_dens(t_seq, p0 = 0.1, p1 = 0.4, alpha = 0.25, shape = 1.2, scale = 2.5, activation = "random") print(d_vals)t_seq <- seq(0.1, 10, by = 1) d_vals <- ziprom_core_dens(t_seq, p0 = 0.1, p1 = 0.4, alpha = 0.25, shape = 1.2, scale = 2.5, activation = "random") print(d_vals)
Computes the unconditional population survival function .
ziprom_core_surv( t, p0, p1, alpha = 0, shape = 1, scale = 1, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )ziprom_core_surv( t, p0, p1, alpha = 0, shape = 1, scale = 1, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential") )
t |
Numeric vector of non-negative times. |
p0 |
Numeric vector or scalar of zero-failure probabilities. |
p1 |
Numeric vector or scalar of cure fractions. |
alpha |
Numeric scalar representing Gamma frailty variance (>= 0). |
shape |
Numeric vector or scalar for shape parameter. |
scale |
Numeric vector or scalar for scale parameter. |
activation |
Character string for activation scheme ( |
baseline |
Character string for baseline hazard distribution ( |
Numeric vector of population survival probabilities.
t_seq <- seq(0, 10, by = 1) s_vals <- ziprom_core_surv(t_seq, p0 = 0.1, p1 = 0.4, alpha = 0.25, shape = 1.2, scale = 2.5, activation = "random") print(s_vals)t_seq <- seq(0, 10, by = 1) s_vals <- ziprom_core_surv(t_seq, p0 = 0.1, p1 = 0.4, alpha = 0.25, shape = 1.2, scale = 2.5, activation = "random") print(s_vals)
Fits generalized zero-inflated promotion cure-rate regression models with Gamma frailty and flexible activation schemes (minimum, maximum, or random) using Maximum Likelihood Estimation (MLE).
ziprom_fit( formula = NULL, data = NULL, formula_p0 = NULL, formula_p1 = NULL, formula_shape = NULL, formula_scale = NULL, time = NULL, status = NULL, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential"), frailty = TRUE, init = NULL, control = list() )ziprom_fit( formula = NULL, data = NULL, formula_p0 = NULL, formula_p1 = NULL, formula_shape = NULL, formula_scale = NULL, time = NULL, status = NULL, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential"), frailty = TRUE, init = NULL, control = list() )
formula |
An object of class |
data |
A data frame containing the variables named in the formulas.
Missing values ( |
formula_p0 |
Optional one-sided formula for the zero-inflation component |
formula_p1 |
Optional one-sided formula for the cure fraction component |
formula_shape |
Optional one-sided formula for the baseline shape parameter |
formula_scale |
Optional one-sided formula for the baseline scale parameter |
time |
Optional numeric vector of observed survival times (used if |
status |
Optional numeric vector of event indicators (1 = event, 0 = censored). |
activation |
Character string specifying the activation scheme:
|
baseline |
Character string specifying the baseline activation-time distribution:
|
frailty |
Logical value ( |
init |
Optional numeric vector of starting values for the optimization. |
control |
Optional list of control parameters passed to |
Missing values (NA) in the response or covariates are omitted prior to estimation.
Observations with survival time equal to zero () represent instantaneous failures and
are naturally accommodated via the zero-inflation probability mass .
An S3 object of class "ziprom_fit" containing:
coefficientsVector of maximum likelihood estimates for all parameters.
coef_listList of estimated coefficients partitioned by component (beta1, beta2, beta3, beta4, alpha).
seStandard errors of parameter estimates obtained from the inverted observed Hessian.
z_valuesWald z-test statistics ().
p_valuesTwo-sided asymptotic p-values for Wald tests.
ci_9090% Wald confidence intervals for parameters.
ci_9595% Wald confidence intervals for parameters.
ci_9999% Wald confidence intervals for parameters.
vcovEstimated asymptotic variance-covariance matrix.
hessianObserved information / Hessian matrix at the optimum.
loglikMaximum log-likelihood value.
nparNumber of free estimated parameters.
aicAkaike Information Criterion ().
bicBayesian Information Criterion ().
hqicHannan-Quinn Information Criterion.
caicConsistent Akaike Information Criterion.
p0_meanEstimated zero-failure proportion at mean covariates.
p0_mean_seDelta-method standard error for mean .
p1_meanEstimated cure fraction at mean covariates.
p1_mean_seDelta-method standard error for mean .
p0_ci_9595% confidence interval for mean .
p1_ci_9595% confidence interval for mean .
fitted_p0Fitted zero-inflation probabilities for each subject.
fitted_p1Fitted cure probabilities for each subject.
residualsNormalized randomized quantile residuals.
nTotal sample size.
n_zerosNumber of instantaneous zero failures ().
n_eventsNumber of positive observed events ().
n_censoredNumber of right-censored observations ().
activationActivation scheme used.
baselineBaseline hazard distribution used.
frailtyLogical indicating whether frailty was modeled.
convergenceConvergence code returned by optim (0 indicates success).
dataData frame containing the modeled variables.
callThe matched function call.
Assuncao, D., Ramos, P. L., Tomazella, V., Leao, J., Osses, L., and Rodrigues, A. (2026). Zero-Inflated Promotion Cure-Rate Models With Frailty and Flexible Activation Schemes. Biometrical Journal, 68:e70162. doi:10.1002/bimj.70162
set.seed(42) sim_dat <- sim_ziprom(n = 80, beta1 = c(-1.5, 0.4), beta2 = c(-0.8, 0.6), beta3 = c(0.2, 0.1), beta4 = c(1.0, 0.5), alpha = 0.25, activation = "random", baseline = "weibull") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random", frailty = TRUE) summary(fit)set.seed(42) sim_dat <- sim_ziprom(n = 80, beta1 = c(-1.5, 0.4), beta2 = c(-0.8, 0.6), beta3 = c(0.2, 0.1), beta4 = c(1.0, 0.5), alpha = 0.25, activation = "random", baseline = "weibull") fit <- ziprom_fit(survival::Surv(time, status) ~ x, data = sim_dat, activation = "random", frailty = TRUE) summary(fit)
Computes the exact log-likelihood for the zero-adjusted promotion cure-rate model with Gamma frailty and activation schemes under random right censoring.
ziprom_loglik( par, time, status, X1, X2, X3, X4, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential"), frailty = TRUE )ziprom_loglik( par, time, status, X1, X2, X3, X4, activation = c("random", "minimum", "maximum"), baseline = c("weibull", "gompertz", "exponential"), frailty = TRUE )
par |
Numeric vector of parameters: |
time |
Numeric vector of non-negative observed survival times. |
status |
Numeric vector of event indicators (1 = event, 0 = censored). |
X1 |
Design matrix for zero-inflation probability |
X2 |
Design matrix for cure probability |
X3 |
Design matrix for baseline shape parameter |
X4 |
Design matrix for baseline scale parameter |
activation |
Character string: |
baseline |
Character string: |
frailty |
Logical indicating whether Gamma frailty is included ( |
Scalar value of the negative log-likelihood (for minimization in optim),
or the positive log-likelihood if called with appropriate sign.
Assuncao, D., Ramos, P. L., Tomazella, V., Leao, J., Osses, L., and Rodrigues, A. (2026). Zero-Inflated Promotion Cure-Rate Models With Frailty and Flexible Activation Schemes. Biometrical Journal, 68:e70162. doi:10.1002/bimj.70162
set.seed(123) dat <- sim_ziprom(n = 50, activation = "random") X <- matrix(1, nrow = nrow(dat), ncol = 1) par_init <- c(-0.5, 1.0, 0.0, 1.0, log(0.25)) nll <- ziprom_loglik(par_init, dat$time, dat$status, X, X, X, X, activation = "random", baseline = "weibull", frailty = TRUE) print(nll)set.seed(123) dat <- sim_ziprom(n = 50, activation = "random") X <- matrix(1, nrow = nrow(dat), ncol = 1) par_init <- c(-0.5, 1.0, 0.0, 1.0, log(0.25)) nll <- ziprom_loglik(par_init, dat$time, dat$status, X, X, X, X, activation = "random", baseline = "weibull", frailty = TRUE) print(nll)