| Title: | Goodness-of-Fit Tests for Complete, Progressively Type-II, Type-I Hybrid, and Type-II Hybrid Censored Data |
|---|---|
| Description: | Provides goodness-of-fit tests for lifetime data collected under complete sampling, progressive Type-II censoring, and Type-I/Type-II hybrid censoring schemes. Users supply the observed (censored) data and the assumed probability density/mass function, cumulative distribution function, or survival function of the target model, and the package returns the corresponding test statistic together with an asymptotic or Monte Carlo p-value. Implements the spacings-based exponentiality test of Balakrishnan, Ng and Kannan (2002, in "Goodness-of-Fit Tests and Model Validity", Birkhauser, pp. 89-111) and its location-scale generalization Balakrishnan, Ng and Kannan (2004) <doi:10.1109/TR.2004.833317>, the power comparison and Kaplan-Meier based tests of Doering and Cramer (2019) <doi:10.1080/00949655.2019.1648468>, the Kolmogorov-Smirnov type tests for hybrid censored data of Banerjee and Pradhan (2018) <doi:10.1080/03610926.2016.1205616>, and follows the unified treatment of hybrid censoring schemes reviewed in Balakrishnan and Kundu (2013) <doi:10.1016/j.csda.2012.03.025> and in Cramer and Balakrishnan (2023, "Hybrid Censoring Know-How", Chapter 11) <doi:10.1016/B978-0-12-398387-9.00019-2>. |
| 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-10-04 09:43:51 UTC |
| Source: | https://github.com/cran/gofPHCS |
Fatigue lifetimes (in 10^3 cycles) of 101 aluminum coupons under periodic stress loading.
aluminum_couponsaluminum_coupons
A numeric vector of length 101.
Birnbaum, Z. W., & Saunders, S. C. (1958). A statistical model for life-length of materials. JASA, 53(281), 151-160.
Banerjee, B., & Pradhan, B. (2018). Kolmogorov-Smirnov test for life test data with hybrid censoring. Communications in Statistics - Theory and Methods, 47(11), 2590-2604.
Constructor for creating a structured censored dataset object of class "cens_data".
cens_data( x, scheme = c("complete", "typeII", "progtypeII", "hybridI", "hybridII", "hybridI_hcs", "hybridII_hcs"), n = length(x), r = NULL, R = NULL, T0 = NULL, verbose = FALSE )cens_data( x, scheme = c("complete", "typeII", "progtypeII", "hybridI", "hybridII", "hybridI_hcs", "hybridII_hcs"), n = length(x), r = NULL, R = NULL, T0 = NULL, verbose = FALSE )
x |
Numeric vector of observed failure times. Must be finite. |
scheme |
Character string specifying the censoring scheme. Options are:
|
n |
Total sample size at the beginning of the experiment. Defaults to |
r |
Integer specifying the pre-fixed failure count for Type-II or hybrid censoring schemes. |
R |
Integer vector of progressive removals for |
T0 |
Positive numeric value for pre-fixed time threshold in hybrid censoring schemes. |
verbose |
Logical; if |
An S3 object of class "cens_data" containing:
x |
Numeric vector of sorted observed failure times. |
scheme |
Censoring scheme name. |
n |
Total initial sample size. |
n_obs |
Number of observed failure times |
r |
Pre-fixed failure count (if applicable). |
R |
Progressive removal vector (if applicable). |
T0 |
Time threshold (if applicable). |
Cramer, E., & Balakrishnan, N. (2023). Goodness-of-fit tests. In Hybrid Censoring Know-How (Chapter 11, pp. 321-329). Academic Press. doi:10.1016/B978-0-12-398387-9.00019-2
# Complete data cd1 <- cens_data(x = c(0.5, 1.2, 2.1, 3.4), scheme = "complete") print(cd1) # Progressive Type-II censored data cd2 <- cens_data(x = c(0.19, 0.78, 0.96, 1.31), scheme = "progtypeII", R = c(0, 1, 0, 2)) summary(cd2)# Complete data cd1 <- cens_data(x = c(0.5, 1.2, 2.1, 3.4), scheme = "complete") print(cd1) # Progressive Type-II censored data cd2 <- cens_data(x = c(0.19, 0.78, 0.96, 1.31), scheme = "progtypeII", R = c(0, 1, 0, 2)) summary(cd2)
Main function for conducting goodness-of-fit tests on complete, progressively Type-II, and hybrid censored lifetime data.
gof_test( data, pdf = NULL, cdf = NULL, sf = NULL, pmf = NULL, distribution = NULL, params = NULL, statistic = "auto", p.method = c("auto", "asymptotic", "montecarlo"), nsim = 9999, seed = NULL, conf.level = 0.95, ... )gof_test( data, pdf = NULL, cdf = NULL, sf = NULL, pmf = NULL, distribution = NULL, params = NULL, statistic = "auto", p.method = c("auto", "asymptotic", "montecarlo"), nsim = 9999, seed = NULL, conf.level = 0.95, ... )
data |
A |
pdf |
Optional probability density function |
cdf |
Optional cumulative distribution function |
sf |
Optional survival function |
pmf |
Optional probability mass function |
distribution |
Optional pre-constructed |
params |
Parameter vector or named list for the null distribution. |
statistic |
Character string specifying test statistic name. Default |
p.method |
Character string specifying p-value calculation method ( |
nsim |
Integer specifying number of Monte Carlo replicates. Default is 9999. |
seed |
Optional integer seed for reproducible Monte Carlo simulation. |
conf.level |
Confidence level (default 0.95). |
... |
Additional arguments passed to specific statistic functions (e.g. |
An object of class c("gof_htest", "htest") containing:
statistic |
Observed test statistic value. |
p.value |
Calculated p-value. |
method |
Character string describing the test. |
data.name |
Character string describing the dataset. |
estimate |
Parameter estimates / fitted values. |
Balakrishnan, N., Ng, H. K. T., & Kannan, N. (2002). A test of exponentiality based on spacings for progressively type-II censored data. In Goodness-of-Fit Tests and Model Validity (pp. 89-111). Birkhauser.
Banerjee, B., & Pradhan, B. (2018). Kolmogorov-Smirnov test for life test data with hybrid censoring. Communications in Statistics - Theory and Methods, 47(11), 2590-2604. doi:10.1080/03610926.2016.1205616
Cramer, E., & Balakrishnan, N. (2023). Goodness-of-fit tests. In Hybrid Censoring Know-How (Chapter 11). Academic Press. doi:10.1016/B978-0-12-398387-9.00019-2
set.seed(42) x_data <- rexp(15, rate = 0.5) cd <- cens_data(x = x_data, scheme = "complete") dist <- make_distribution(cdf = function(x, rate) pexp(x, rate), params = c(rate = 0.5)) res <- gof_test(cd, distribution = dist, statistic = "KS", p.method = "montecarlo", nsim = 99) print(res)set.seed(42) x_data <- rexp(15, rate = 0.5) cd <- cens_data(x = x_data, scheme = "complete") dist <- make_distribution(cdf = function(x, rate) pexp(x, rate), params = c(rate = 0.5)) res <- gof_test(cd, distribution = dist, statistic = "KS", p.method = "montecarlo", nsim = 99) print(res)
Times to breakdown (in minutes) of an insulating fluid subjected to high voltage stress.
insulating_fluidinsulating_fluid
A numeric vector of length 18.
Nelson, W. (1982). Applied Life Data Analysis. John Wiley & Sons.
Cramer, E., & Balakrishnan, N. (2023). Goodness-of-fit tests. In Hybrid Censoring Know-How (Chapter 11). Academic Press.
Constructs a distribution object encapsulating probability density function (pdf),
cumulative distribution function (cdf), survival function (sf), and quantile function (qdist).
Missing functions are derived automatically using numerical calculus and root-finding.
make_distribution( pdf = NULL, cdf = NULL, sf = NULL, pmf = NULL, discrete = FALSE, support = c(-Inf, Inf), params = NULL )make_distribution( pdf = NULL, cdf = NULL, sf = NULL, pmf = NULL, discrete = FALSE, support = c(-Inf, Inf), params = NULL )
pdf |
Probability density function |
cdf |
Cumulative distribution function |
sf |
Survival function |
pmf |
Probability mass function |
discrete |
Logical indicating if the distribution is discrete. Default is |
support |
Numeric vector of length 2 defining distribution support bounds |
params |
Named list or numeric vector of parameters passed to |
An S3 object of class "gof_distribution" containing:
pdf |
Vectorized density function |
cdf |
Vectorized CDF function |
sf |
Vectorized survival function |
qdist |
Vectorized quantile function |
discrete |
Logical flag. |
support |
Support interval. |
params |
User-supplied parameter vector or list. |
# Create an Exponential distribution adapter exp_dist <- make_distribution( cdf = function(x, rate) pexp(x, rate = rate), params = c(rate = 0.5), support = c(0, Inf) ) exp_dist$cdf(1) exp_dist$pdf(1)# Create an Exponential distribution adapter exp_dist <- make_distribution( cdf = function(x, rate) pexp(x, rate = rate), params = c(rate = 0.5), support = c(0, Inf) ) exp_dist$cdf(1) exp_dist$pdf(1)
Generates simulated datasets under specified censoring schemes from a quantile function qdist.
rcens( scheme = c("complete", "progtypeII", "hybridI", "hybridII", "hybridI_hcs", "hybridII_hcs"), n, R = NULL, r = NULL, T0 = NULL, qdist, nsim = 1 )rcens( scheme = c("complete", "progtypeII", "hybridI", "hybridII", "hybridI_hcs", "hybridII_hcs"), n, R = NULL, r = NULL, T0 = NULL, qdist, nsim = 1 )
scheme |
Character string specifying censoring scheme ( |
n |
Integer specifying initial sample size. |
R |
Integer vector of progressive removals. |
r |
Integer specifying target failure count for Type-II or hybrid schemes. |
T0 |
Numeric value specifying time threshold for hybrid schemes. |
qdist |
Quantile function |
nsim |
Integer specifying the number of datasets to simulate. Default is 1. |
If nsim = 1, returns a single "cens_data" object. If nsim > 1, returns a list of "cens_data" objects.
Balakrishnan, N., & Sandhu, R. A. (1995). A simple simulational algorithm for generating progressive Type-II censored samples. The American Statistician, 49(2), 229-230.
Banerjee, B., & Pradhan, B. (2018). Kolmogorov-Smirnov test for life test data with hybrid censoring. Communications in Statistics - Theory and Methods, 47(11), 2590-2604. doi:10.1080/03610926.2016.1205616
# Simulate a progressive Type-II censored sample from Standard Exponential set.seed(123) sim_data <- rcens( scheme = "progtypeII", n = 10, R = c(0, 1, 0, 1, 3), qdist = function(p) qexp(p, rate = 1) ) print(sim_data)# Simulate a progressive Type-II censored sample from Standard Exponential set.seed(123) sim_data <- rcens( scheme = "progtypeII", n = 10, R = c(0, 1, 0, 1, 3), qdist = function(p) qexp(p, rate = 1) ) print(sim_data)