| Title: | Algorithm for Generating Tie-Free Progressive Type-II Censored Samples |
|---|---|
| Description: | Generates tie-free progressive Type-II censored samples from discrete distributions and user-specified discrete probability mass functions (PMF) or cumulative distribution functions (CDF). Provides maximum likelihood estimation (MLE), Bayesian estimation via Markov chain Monte Carlo (MCMC) Metropolis-within-Gibbs sampling, likelihood-based parametric bootstrap goodness-of-fit (GOF) tests, profile log-likelihood diagnostics, and discrete survival and probability calculations. Methods are based on Ahmad and Mansour (2026) <doi:10.1155/jom/3657078>, Balakrishnan and Dembinska (2008) <doi:10.1016/j.jspi.2007.02.006>, Joe and Zhu (2005) <doi:10.1002/bimj.200410102>, and Balakrishnan and Aggarwala (2000, ISBN:978-1-4612-1334-5). |
| Authors: | Shikhar Tyagi [aut, cre] (ORCID: <https://orcid.org/0000-0003-1606-0844>), Arvind Pandey [aut], Bhupendra Singh [aut], Vrijesh Tripathi [aut] |
| Maintainer: | Shikhar Tyagi <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.1.0 |
| Built: | 2026-09-21 09:40:42 UTC |
| Source: | https://github.com/cran/TieFreeCensor |
Coef Method for GPD MLE
## S3 method for class 'gpd_mle' coef(object, ...)## S3 method for class 'gpd_mle' coef(object, ...)
object |
Object of class |
... |
Additional arguments. |
A named numeric vector of length 2 containing the maximum likelihood estimates for parameters q (mean parameter) and h (dispersion parameter).
Dataset containing 25 daily COVID-19 death counts recorded in the US Virgin Islands during May 2021, as reported by Worldometer (2021) and analyzed by Ahmad and Mansour (2026).
covid_deathscovid_deaths
A numeric vector of length 25 containing daily reported death counts.
Worldometer (2021). COVID-19 Coronavirus Pandemic.
Ahmad, H. H., & Mansour, M. M. M. (2026). An Algorithm for Generating Tie-Free Progressive Type-II Censored Samples From Discrete Distributions. Journal of Mathematics, 2026, 3657078.
Fits the Generalized Poisson Distribution (GPD) to a tie-free progressively Type-II right-censored sample using Bayesian Markov chain Monte Carlo (MCMC) with Metropolis-within-Gibbs sampling on transformed parameters.
fit_gpd_bayes( x, R, hyper_a = 1, hyper_b = 1, hyper_c = 10, iter = 5000, burnin = 1000, thin = 1, start = NULL, prop_sd = c(0.05, 0.05), conf_level = 0.95 )fit_gpd_bayes( x, R, hyper_a = 1, hyper_b = 1, hyper_c = 10, iter = 5000, burnin = 1000, thin = 1, start = NULL, prop_sd = c(0.05, 0.05), conf_level = 0.95 )
x |
Numeric vector of observed tie-free failure times |
R |
Numeric vector of progressive removal counts |
hyper_a |
Shape parameter |
hyper_b |
Shape parameter |
hyper_c |
Scale parameter |
iter |
Total number of MCMC iterations. Default is 5000. |
burnin |
Number of initial iterations discarded as burn-in. Default is 1000. |
thin |
Thinning interval. Default is 1. |
start |
Numeric vector of length 2 giving starting values |
prop_sd |
Numeric vector of length 2 specifying proposal standard deviations for |
conf_level |
Credible level for equal-tailed credible intervals (CRI). Default is 0.95. |
A list of class "gpd_bayes" containing:
estimates: Vector of posterior means (SEL) for and .
sd: Posterior standard deviations.
cri: Matrix of equal-tailed credible intervals (2.5% and 97.5% quantiles).
draws: Matrix of thinned MCMC posterior samples for and .
accept_rates: Acceptance rates for MCMC updates.
data: List containing original input data.
Ahmad, H. H., & Mansour, M. M. M. (2026). An Algorithm for Generating Tie-Free Progressive Type-II Censored Samples From Discrete Distributions. Journal of Mathematics, 2026, 3657078. doi:10.1155/jom/3657078
# NF2 Spinal Tumors dataset example from paper x_tumor <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16) R_tumor <- c(69, 12, 14, 5, 6, 4, 8, 8, 0, 1, 4, 0, 0, 0, 0, 11) set.seed(123) fit_b <- fit_gpd_bayes(x = x_tumor, R = R_tumor, iter = 2000, burnin = 500) print(fit_b) summary(fit_b)# NF2 Spinal Tumors dataset example from paper x_tumor <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16) R_tumor <- c(69, 12, 14, 5, 6, 4, 8, 8, 0, 1, 4, 0, 0, 0, 0, 11) set.seed(123) fit_b <- fit_gpd_bayes(x = x_tumor, R = R_tumor, iter = 2000, burnin = 500) print(fit_b) summary(fit_b)
Fits the Generalized Poisson Distribution (GPD) to a tie-free progressively Type-II right-censored sample using Maximum Likelihood Estimation (MLE).
fit_gpd_mle(x, R, start = NULL, method = "BFGS", conf_level = 0.95, ...)fit_gpd_mle(x, R, start = NULL, method = "BFGS", conf_level = 0.95, ...)
x |
Numeric vector of observed tie-free failure times |
R |
Numeric vector of progressive removal counts |
start |
Numeric vector of length 2 giving initial parameter values |
method |
Optimization method passed to |
conf_level |
Confidence level for asymptotic confidence intervals (ACI). Default is 0.95. |
... |
Additional control parameters passed to |
An object of class "gpd_mle" containing:
par: Vector of estimated parameters .
se: Vector of standard errors for and .
vcov: Estimated variance-covariance matrix.
loglik: Maximum log-likelihood value.
aci: Matrix of asymptotic confidence intervals.
convergence: Optimization convergence code.
data: List containing original data x and removal scheme R.
Ahmad, H. H., & Mansour, M. M. M. (2026). An Algorithm for Generating Tie-Free Progressive Type-II Censored Samples From Discrete Distributions. Journal of Mathematics, 2026, 3657078. doi:10.1155/jom/3657078
# NF2 Spinal Tumors dataset example from paper x_tumor <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16) R_tumor <- c(69, 12, 14, 5, 6, 4, 8, 8, 0, 1, 4, 0, 0, 0, 0, 11) fit_mle <- fit_gpd_mle(x = x_tumor, R = R_tumor) print(fit_mle) summary(fit_mle)# NF2 Spinal Tumors dataset example from paper x_tumor <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16) R_tumor <- c(69, 12, 14, 5, 6, 4, 8, 8, 0, 1, 4, 0, 0, 0, 0, 11) fit_mle <- fit_gpd_mle(x = x_tumor, R = R_tumor) print(fit_mle) summary(fit_mle)
Implements the constructive algorithm described by Ahmad and Mansour (2026) to generate progressively Type-II right-censored samples that are guaranteed to be free of ties, even when the underlying discrete distribution produces repeated values.
generate_tiefree_p2c( x0 = NULL, n = NULL, m = NULL, R = NULL, dist = c("gpd", "poisson", "geometric", "nbinom", "custom"), dist_pmf = NULL, dist_cdf = NULL, params = list(), max_attempts = 100 )generate_tiefree_p2c( x0 = NULL, n = NULL, m = NULL, R = NULL, dist = c("gpd", "poisson", "geometric", "nbinom", "custom"), dist_pmf = NULL, dist_cdf = NULL, params = list(), max_attempts = 100 )
x0 |
Numeric vector representing the original complete discrete dataset (with potential ties), or NULL if generating from a distribution. |
n |
Target total sample size (if generating from distribution). Defaults to |
m |
Target number of observed failures. If NULL or larger than the maximum available distinct values, it is automatically adjusted. |
R |
Numeric vector specifying the progressive removal scheme |
dist |
Character string specifying built-in discrete distribution if |
dist_pmf |
Custom function for discrete PMF |
dist_cdf |
Custom function for discrete CDF |
params |
List of parameter values passed to distribution functions. |
max_attempts |
Maximum number of simulation attempts to find a tie-free sample before reducing candidate |
A list of class "tiefree_p2c" containing:
x |
Numeric vector of tie-free observed progressive Type-II failure times |
R |
Numeric vector of final progressive removal counts. |
n |
Total original sample size. |
m |
Final number of observed failure times. |
x0 |
Original discrete dataset (with ties). |
m_max |
Number of distinct values in the original dataset. |
Ahmad, H. H., & Mansour, M. M. M. (2026). An Algorithm for Generating Tie-Free Progressive Type-II Censored Samples From Discrete Distributions. Journal of Mathematics, 2026, 3657078. doi:10.1155/jom/3657078
Balakrishnan, N., & Dembińska, A. (2008). Progressively Type-II right censored order statistics from discrete distributions. Journal of Statistical Planning and Inference, 138(4), 845-856.
set.seed(123) # Generate tie-free progressive Type-II sample from GPD res <- generate_tiefree_p2c(n = 30, m = 15, dist = "gpd", params = list(q = 3.0, h = 0.3)) print(res) # Generate tie-free sample from a raw dataset with ties raw_data <- c(0,0,0,1,1,2,2,3,4,4,5,6,6,7,8,9,10) res_raw <- generate_tiefree_p2c(x0 = raw_data, m = 8) print(res_raw)set.seed(123) # Generate tie-free progressive Type-II sample from GPD res <- generate_tiefree_p2c(n = 30, m = 15, dist = "gpd", params = list(q = 3.0, h = 0.3)) print(res) # Generate tie-free sample from a raw dataset with ties raw_data <- c(0,0,0,1,1,2,2,3,4,4,5,6,6,7,8,9,10) res_raw <- generate_tiefree_p2c(x0 = raw_data, m = 8) print(res_raw)
Evaluates model adequacy for progressively Type-II censored discrete data using a likelihood-based parametric bootstrap test, as formulated in Section 6.1 of Ahmad and Mansour (2026).
gof_p2c_bootstrap(x, R, B = 100, dist = "gpd", alpha = 0.05)gof_p2c_bootstrap(x, R, B = 100, dist = "gpd", alpha = 0.05)
x |
Numeric vector of observed tie-free failure times |
R |
Numeric vector of progressive removal counts |
B |
Number of bootstrap replications. Default is 100. |
dist |
Model family under test. Default is |
alpha |
Significance level for hypothesis testing. Default is 0.05. |
An object of class "gof_bootstrap" containing:
statistic: Observed test statistic .
p_value: Monte Carlo bootstrap -value.
mle: MLE fit object for the observed dataset.
bootstrap_stats: Vector of bootstrap test statistics .
B: Number of successful bootstrap replicates.
decision: Hypothesis test conclusion ("Fail to reject H0" or "Reject H0").
Ahmad, H. H., & Mansour, M. M. M. (2026). An Algorithm for Generating Tie-Free Progressive Type-II Censored Samples From Discrete Distributions. Journal of Mathematics, 2026, 3657078. doi:10.1155/jom/3657078
Besag, J., & Clifford, P. (1991). Sequential Monte Carlo p-values. Biometrika, 78(2), 301-304.
# NF2 Spinal Tumors dataset test x_tumor <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16) R_tumor <- c(69, 12, 14, 5, 6, 4, 8, 8, 0, 1, 4, 0, 0, 0, 0, 11) set.seed(123) test_res <- gof_p2c_bootstrap(x = x_tumor, R = R_tumor, B = 20) print(test_res)# NF2 Spinal Tumors dataset test x_tumor <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16) R_tumor <- c(69, 12, 14, 5, 6, 4, 8, 8, 0, 1, 4, 0, 0, 0, 0, 11) set.seed(123) test_res <- gof_p2c_bootstrap(x = x_tumor, R = R_tumor, B = 20) print(test_res)
Evaluates the cumulative distribution function (CDF) of the Generalized Poisson Distribution (GPD).
gpd_cdf(x, q, h, lower_tail = TRUE, log_p = FALSE)gpd_cdf(x, q, h, lower_tail = TRUE, log_p = FALSE)
x |
Numeric vector of quantiles. |
q |
Parameter |
h |
Parameter |
lower_tail |
Logical; if TRUE (default), probabilities are |
log_p |
Logical; if TRUE, probabilities are given as |
Numeric vector of CDF values.
gpd_cdf(x = 5, q = 3.0, h = 0.2)gpd_cdf(x = 5, q = 3.0, h = 0.2)
Evaluates the probability mass function (PMF) of the Generalized Poisson Distribution (GPD).
gpd_pmf(x, q, h, log_p = FALSE)gpd_pmf(x, q, h, log_p = FALSE)
x |
Numeric vector of non-negative integer quantiles. |
q |
Parameter |
h |
Parameter |
log_p |
Logical; if TRUE, probabilities are given as |
Numeric vector of PMF values.
Ahmad, H. H., & Mansour, M. M. M. (2026). An Algorithm for Generating Tie-Free Progressive Type-II Censored Samples From Discrete Distributions. Journal of Mathematics, 2026, 3657078. doi:10.1155/jom/3657078
Joe, H., & Zhu, R. (2005). Generalized Poisson distribution: the property of mixture of Poisson and comparison with negative binomial distribution. Biometrical Journal, 47(2), 219-229.
gpd_pmf(x = 0:10, q = 3.0, h = 0.2)gpd_pmf(x = 0:10, q = 3.0, h = 0.2)
Generates random variates from the Generalized Poisson Distribution (GPD).
gpd_random(n, q, h)gpd_random(n, q, h)
n |
Number of observations to sample. |
q |
Parameter |
h |
Parameter |
Numeric vector of random counts.
set.seed(123) gpd_random(n = 20, q = 3.0, h = 0.2)set.seed(123) gpd_random(n = 20, q = 3.0, h = 0.2)
LogLik Method for GPD MLE
## S3 method for class 'gpd_mle' logLik(object, ...)## S3 method for class 'gpd_mle' logLik(object, ...)
object |
Object of class |
... |
Additional arguments. |
An object of class "logLik" containing the maximum log-likelihood value of the fitted GPD model, with attributes "df" (degrees of freedom, equal to 2) and "nobs" (number of observed failures ).
Computes and plots the profile log-likelihood curves for the parameters and of the Generalized Poisson Distribution (GPD) under progressive Type-II censoring (Figures 3 and 4 in Ahmad and Mansour, 2026).
plot_profile_loglik( x, R, param = c("both", "q", "h"), grid_len = 50, q_range = NULL, h_range = NULL, main = NULL )plot_profile_loglik( x, R, param = c("both", "q", "h"), grid_len = 50, q_range = NULL, h_range = NULL, main = NULL )
x |
Numeric vector of observed tie-free failure times |
R |
Numeric vector of progressive removal counts |
param |
Character string specifying parameter to profile: |
grid_len |
Integer specifying the number of evaluation points along the profile grid. Default is 50. |
q_range |
Numeric vector of length 2 specifying range for |
h_range |
Numeric vector of length 2 specifying range for |
main |
Optional title for plot. |
Invisible list containing grid points and profile log-likelihood values.
Ahmad, H. H., & Mansour, M. M. M. (2026). An Algorithm for Generating Tie-Free Progressive Type-II Censored Samples From Discrete Distributions. Journal of Mathematics, 2026, 3657078. doi:10.1155/jom/3657078
# NF2 Spinal Tumors dataset profile log-likelihood x_tumor <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16) R_tumor <- c(69, 12, 14, 5, 6, 4, 8, 8, 0, 1, 4, 0, 0, 0, 0, 11) plot_profile_loglik(x = x_tumor, R = R_tumor, param = "both")# NF2 Spinal Tumors dataset profile log-likelihood x_tumor <- c(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16) R_tumor <- c(69, 12, 14, 5, 6, 4, 8, 8, 0, 1, 4, 0, 0, 0, 0, 11) plot_profile_loglik(x = x_tumor, R = R_tumor, param = "both")
Plot Method for GPD Bayesian MCMC Diagnostics
## S3 method for class 'gpd_bayes' plot(x, ...)## S3 method for class 'gpd_bayes' plot(x, ...)
x |
Object of class |
... |
Additional arguments. |
No return value, called for side effects. Generates MCMC diagnostic trace plots and posterior distribution histograms for parameters q and h.
Print Method for GOF Bootstrap Test Result
## S3 method for class 'gof_bootstrap' print(x, ...)## S3 method for class 'gof_bootstrap' print(x, ...)
x |
Object of class |
... |
Additional arguments. |
Invisibly returns the input object x of class "gof_bootstrap". Called for its side effect of printing the goodness-of-fit test statistic, bootstrap replicates, Monte Carlo p-value, and test decision to the console.
Print Method for GPD Bayesian MCMC Estimation
## S3 method for class 'gpd_bayes' print(x, ...)## S3 method for class 'gpd_bayes' print(x, ...)
x |
Object of class |
... |
Additional arguments. |
Invisibly returns the input object x of class "gpd_bayes". Called for its side effect of printing Bayesian posterior point estimates and MCMC acceptance rates to the console.
Print Method for GPD MLE
## S3 method for class 'gpd_mle' print(x, ...)## S3 method for class 'gpd_mle' print(x, ...)
x |
Object of class |
... |
Additional arguments. |
Invisibly returns the input object x of class "gpd_mle". Called for its side effect of printing the GPD maximum likelihood parameter estimates and log-likelihood value to the console.
Print Method for Tie-Free Progressive Type-II Sample
## S3 method for class 'tiefree_p2c' print(x, ...)## S3 method for class 'tiefree_p2c' print(x, ...)
x |
An object of class |
... |
Additional arguments. |
Invisibly returns the input object x of class "tiefree_p2c". Called for its side effect of printing details of the tie-free progressive Type-II sample to the console.
Computes specific discrete probabilities such as , , , , or .
prob_gpd(q, h, type = c("eq", "gt", "gte", "lt", "lte"), x = 0, k = 0)prob_gpd(q, h, type = c("eq", "gt", "gte", "lt", "lte"), x = 0, k = 0)
q |
Parameter |
h |
Parameter |
type |
Character string indicating the probability type: |
x |
Non-negative integer for |
k |
Non-negative integer bound for inequalities. |
Numeric probability value.
prob_gpd(q = 5.62, h = 0.75, type = "eq", x = 0) prob_gpd(q = 5.62, h = 0.75, type = "gt", k = 10)prob_gpd(q = 5.62, h = 0.75, type = "eq", x = 0) prob_gpd(q = 5.62, h = 0.75, type = "gt", k = 10)
Dataset containing spinal tumor counts from 158 patients with Neurofibromatosis Type 2 (NF2), originally presented by Joe and Zhu (2005) and analyzed under progressive censoring by Ahmad and Mansour (2026).
spinal_tumorsspinal_tumors
A data frame with 22 rows and 2 variables:
Number of spinal tumors observed in a patient.
Number of patients exhibiting the given tumor count.
Joe, H., & Zhu, R. (2005). Generalized Poisson distribution: the property of mixture of Poisson and comparison with negative binomial distribution. Biometrical Journal, 47(2), 219-229.
Ahmad, H. H., & Mansour, M. M. M. (2026). An Algorithm for Generating Tie-Free Progressive Type-II Censored Samples From Discrete Distributions. Journal of Mathematics, 2026, 3657078.
Summary Method for GPD Bayesian MCMC Estimation
## S3 method for class 'gpd_bayes' summary(object, ...)## S3 method for class 'gpd_bayes' summary(object, ...)
object |
Object of class |
... |
Additional arguments. |
Invisibly returns the input object object of class "gpd_bayes". Called for its side effect of displaying posterior point estimates, posterior standard errors, and credible intervals in tabular format.
Summary Method for GPD MLE
## S3 method for class 'gpd_mle' summary(object, ...)## S3 method for class 'gpd_mle' summary(object, ...)
object |
Object of class |
... |
Additional arguments. |
Invisibly returns the input object object of class "gpd_mle". Called for its side effect of printing a detailed summary matrix containing MLE estimates, standard errors, and asymptotic confidence intervals.
Vcov Method for GPD MLE
## S3 method for class 'gpd_mle' vcov(object, ...)## S3 method for class 'gpd_mle' vcov(object, ...)
object |
Object of class |
... |
Additional arguments. |
A 2x2 numeric variance-covariance matrix of class "matrix" with row and column names c("q", "h"), containing the estimated asymptotic covariances of the maximum likelihood estimates.