Goodness-of-Fit Tests for Censored Lifetime Data with gofPHCS

Shikhar Tyagi, Arvind Pandey, Bhupendra Singh, Vrijesh Tripathi

Introduction

The gofPHCS package implements a unified framework for conducting goodness-of-fit (GOF) tests on lifetime data subject to complete sampling, progressive Type-II censoring, and Type-I / Type-II hybrid censoring schemes based on Cramer & Balakrishnan (2023).


1. Complete Data Example

For complete failure time data, standard EDF test statistics including Kolmogorov-Smirnov (KS), Cramér-von Mises (CvM), and Anderson-Darling (AD) are supported.

set.seed(123)
x_complete <- rexp(25, rate = 0.5)

# Create censored data container
cd_comp <- cens_data(x = x_complete, scheme = "complete")

# Define target exponential distribution
dist_exp <- make_distribution(
  cdf = function(x, rate) pexp(x, rate = rate),
  params = c(rate = 0.5),
  support = c(0, Inf)
)

# Perform KS test
test_ks <- gof_test(cd_comp, distribution = dist_exp, statistic = "KS", p.method = "montecarlo", nsim = 499)
print(test_ks)
#> 
#>  Monte Carlo Test (499 replicates) (KS for complete scheme)
#> 
#> data:  cd_comp
#> KS = 0.12946, n = 25, n_obs = 25, p-value = 0.746
#> alternative hypothesis: two.sided
#> sample estimates:
#> rate 
#>  0.5 
#> 
#>   Censoring Scheme: complete 
#>   Null Parameters: rate = 0.5

2. Progressive Type-II Censoring Example

Progressive Type-II censoring allows items to be removed at each failure time according to a pre-specified removal plan \(R = (R_1, \dots, R_m)\).

# Example data: insulating fluid breakdown times (n = 19, m = 18)
x_prog <- c(0.19, 0.78, 0.96, 1.31, 2.78, 3.16, 4.15, 4.67, 4.85, 6.50,
            7.35, 8.01, 8.27, 12.06, 31.75, 32.52, 33.91, 36.71)
R_plan <- c(rep(0, 17), 1)

cd_prog <- cens_data(x = x_prog, scheme = "progtypeII", n = 19, R = R_plan)

# Test exponentiality using Spacings Test statistic T (Balakrishnan et al. 2002b)
test_T <- gof_test(cd_prog, distribution = dist_exp, statistic = "T", p.method = "asymptotic")
print(test_T)
#> 
#>  Asymptotic Normal Spacings Test (T for progtypeII scheme)
#> 
#> data:  cd_prog
#> T = 0.3855, n = 19, n_obs = 18, p-value = 0.102
#> alternative hypothesis: two.sided
#> sample estimates:
#> rate 
#>  0.5 
#> 
#>   Censoring Scheme: progtypeII 
#>   Null Parameters: rate = 0.5

3. Type-I Hybrid Censoring Example

In Type-I hybrid censoring, the test terminates at \(T^* = \min(T_0, X_{r:n})\).

set.seed(456)
x_hyb1 <- c(0.25, 0.48, 0.81, 1.05, 1.32)
cd_hyb1 <- cens_data(x = x_hyb1, scheme = "hybridI", n = 10, r = 7, T0 = 1.5)

test_ksi <- gof_test(cd_hyb1, distribution = dist_exp, statistic = "KSI", p.method = "montecarlo", nsim = 499)
print(test_ksi)
#> 
#>  Monte Carlo Test (499 replicates) (KSI for hybridI scheme)
#> 
#> data:  cd_hyb1
#> KSI = 0.42066, n = 10, n_obs = 5, p-value = 0.902
#> alternative hypothesis: two.sided
#> sample estimates:
#> rate 
#>  0.5 
#> 
#>   Censoring Scheme: hybridI 
#>   Null Parameters: rate = 0.5

4. Type-II Hybrid Censoring Example

In Type-II hybrid censoring, the test terminates at \(T^* = \max(T_0, X_{r:n})\).

set.seed(789)
x_hyb2 <- c(0.31, 0.55, 0.92, 1.15, 1.60, 2.10)
cd_hyb2 <- cens_data(x = x_hyb2, scheme = "hybridII", n = 10, r = 5, T0 = 1.0)

test_ksii <- gof_test(cd_hyb2, distribution = dist_exp, statistic = "KSII", p.method = "montecarlo", nsim = 499)
print(test_ksii)
#> 
#>  Monte Carlo Test (499 replicates) (KSII for hybridII scheme)
#> 
#> data:  cd_hyb2
#> KSII = 0.53353, n = 10, n_obs = 6, p-value = 0.774
#> alternative hypothesis: two.sided
#> sample estimates:
#> rate 
#>  0.5 
#> 
#>   Censoring Scheme: hybridII 
#>   Null Parameters: rate = 0.5

References