Package {rReGSPTT}


Type: Package
Title: Repetitive Group Acceptance Sampling Inspection Plans for Time Truncated Life Test
Version: 0.1.0
Description: Designing repetitive group acceptance sampling inspection plans for time-truncated life tests. The package uses a distribution-free formulation in which the user supplies the failure probability. The functions compute operating characteristic probabilities and average sample numbers subject to a consumer's risk constraint. The package also provides graphical and comparative tools for comparing repetitive group, group and single sampling inspection plans. Sherman (1965) <doi:10.2307/1266124>; Aslam and Jun (2013) <doi:10.1007/s00170-013-4747-x>. Saha et al. (2025) <doi:10.1007/s41872-025-00305-w>; Tripathi et al. (2020) <doi:10.1080/02664763.2020.1759031>; Tripathi and Aslam (2024) <doi:10.1285/i20705948v17n3p636>; Tripathi et al. (2022) <doi:10.1007/s40745-020-00267-z>; Saha et al. (2021) <doi:10.1080/21681015.2021.1893843>; Tripathi et al. (2023) <doi:10.1007/s41872-023-00221-x>.
License: GPL-3
Encoding: UTF-8
Config/roxygen2/version: 8.0.0
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-09-18 19:46:00 UTC; Admin
Author: Harsh Tripathi [aut, cre], Mahendra Saha [aut]
Maintainer: Harsh Tripathi <rsearchstat21@gmail.com>
Repository: CRAN
Date/Publication: 2026-09-29 13:40:14 UTC

Compare SSP, GSP and RGASIP

Description

Computes and compares the optimum sample sizes and average sample numbers of single, group and repetitive group acceptance sampling inspection plans.

Usage

compare_rgasip(p, r, c = 0, c1 = 0, c2 = 2, beta = 0.25, n.max = 500)

Arguments

p

Failure probability at the design condition.

r

Number of items inspected in each GSP group.

c

Acceptance number for SSP and GSP.

c1

Acceptance number for RGASIP.

c2

Rejection boundary for RGASIP.

beta

Producer's risk.

n.max

Maximum sample size considered for SSP and RGASIP.

Details

SSP and RGASIP sample sizes are optimized directly over n. For GSP, the group size r is supplied and the minimum number of groups is determined from the producer's risk constraint.

Value

A data frame containing the computed SSP, GSP and RGASIP designs.

Examples


# User-supplied failure probability
compare_rgasip(
  p = 0.10,
  r = 5,
  c = 0,
  c1 = 0,
  c2 = 2,
  beta = 0.25
)

# Generalized Exponential example
a <- 0.5
b <- 1
alpha <- 2

p <- (1 - exp(-a / b))^alpha

compare_rgasip(
  p = p,
  r = 5,
  c = 0,
  c1 = 0,
  c2 = 2,
  beta = 0.25
)

# Weibull example
a <- 0.5
b <- 1
shape <- 2

p <- 1 - exp(-(a / b)^shape)

compare_rgasip(
  p = p,
  r = 5,
  c = 0,
  c1 = 0,
  c2 = 2,
  beta = 0.25
)


Plot Minimum ASN Against Termination Ratio

Description

Computes the minimum ASN for different termination ratios and plots the minimum ASN against the termination ratio.

Usage

plot_rgasip_asn(p, a, b = 1, c1 = 0, c2 = 2, beta = 0.25, n.max = 500)

Arguments

p

A function with arguments a and b returning the failure probability.

a

Vector of termination ratios.

b

Quality ratio.

c1

Acceptance number.

c2

Rejection boundary.

beta

Producer's risk.

n.max

Maximum sample size considered during optimization.

Details

For a time-truncated life test,

a = t/\theta_0

is the termination ratio and

b = \theta/\theta_0

is the quality ratio.

The supplied function p must return the failure probability corresponding to the selected lifetime distribution.

Value

A data frame containing a, b, p, minimum n, probabilities and ASN.

Examples


#---------------------------------------------------------
# Example 1: Generalized Exponential distribution
#---------------------------------------------------------
a <- c(0.5,0.75,1.5,2)
alpha <- 2
b=1
p_GED <- function(a, b) {(1 - exp(-a / b))^alpha}
plot_rgasip_asn(
  p = p_GED,
  a = a,
  b = 1,
  c1 = 0,
  c2 = 2,
  beta = 0.25,
  n.max = 100
)

#---------------------------------------------------------
# Example 2: Weibull distribution
#---------------------------------------------------------
shape <- 2
a <- c(0.5,0.75,1.5,2)
b=1
p_Weibull <- function(a, b) {1 - exp(-(a / b)^shape)}

plot_rgasip_asn(
  p = p_Weibull,
  a = seq(0.2, 2, by = 0.2),
  b = 1,
  c1 = 0,
  c2 = 2,
  beta = 0.25,
  n.max = 100
)


Plot Comparison of SSP, GSP and RGASIP

Description

Produces a graphical comparison of the sample size or average sample number of SSP, GSP and RGASIP.

Usage

plot_rgasip_comparison(p, r, c = 0, c1 = 0, c2 = 2, beta = 0.25, n.max = 500)

Arguments

p

Failure probability at the design condition.

r

Number of items inspected in each GSP group.

c

Acceptance number for SSP and GSP.

c1

Acceptance number for RGASIP.

c2

Rejection boundary for RGASIP.

beta

Producer's risk.

n.max

Maximum sample size considered for optimization.

Value

The comparison data frame invisibly.

Examples


plot_rgasip_comparison(
  p = 0.10,
  r = 5,
  c = 0,
  c1 = 0,
  c2 = 2,
  beta = 0.25
)

#-----------Generalied Exponential Distribution
a <- 0.5
alpha <- 2
b=1
p <- (1- exp(-a / b))^alpha
plot_rgasip_comparison(
 p = p,
 r = 5,
 c = 0,
 c1 = 0,
 c2 = 2,
 beta = 0.25
)


Repetitive Group Acceptance Sampling Inspection Plan

Description

Computes a repetitive group acceptance sampling inspection plan for a time-truncated life test. The procedure is distribution-free because the failure probability p is supplied by the user.

Usage

repetitive_group_asip(p, c1 = 0, c2 = 2, beta = 0.25, n.max = 500)

Arguments

p

Failure probability before the termination time. It must be a numeric value between 0 and 1. For a time-truncated life test, p is generally obtained from the CDF of the lifetime distribution evaluated at the termination time.

c1

Acceptance number. The lot is accepted when the number of failures satisfies d <= c1.

c2

Rejection boundary. The lot is rejected when the number of failures satisfies d > c2. Repetition occurs when c1 < d <= c2.

beta

Producer's risk constraint. The optimum plan satisfies P_A <= beta.

n.max

Maximum sample size considered during optimization.

Details

In each sampling round, a random sample of size n is selected from the lot and placed on a life test for a fixed time t0. Let d denote the number of failures observed during the test.

The lot is accepted if d <= c1, rejected if d > c2, and the sampling procedure is repeated if c1 < d <= c2.

If d follows a binomial distribution with failure probability p, the probability of acceptance in one sampling round is

P_a = \sum_{i=0}^{c_1} {n \choose i} p^i(1-p)^{n-i}

and the probability of rejection in one sampling round is

P_r = 1 - \sum_{i=0}^{c_2} {n \choose i} p^i(1-p)^{n-i}.

The probability of repeating the sampling procedure is

P_{rep} = 1-P_a-P_r.

The operating characteristic probability of the repetitive plan is

P_A = \frac{P_a}{P_a+P_r}.

The average sample number is

ASN = \frac{n}{P_a+P_r}.

The optimum sample size is obtained by minimizing ASN subject to the producer's risk constraint

P_A \leq \beta.

Value

A data frame containing the failure probability, optimum sample size, acceptance number, rejection boundary, one-round acceptance probability, repetition probability, one-round rejection probability, eventual acceptance probability and average sample number.

Examples

#---------------------------------------------------------
# Example 1: User-supplied failure probability
#---------------------------------------------------------
p <- c(0.05, 0.10, 0.15, 0.20)

repetitive_group_asip(
  p = p,
  c1 = 0,
  c2 = 2,
  beta = 0.25,
  n.max = 100
)

#---------------------------------------------------------
# Example 2: Generalized Exponential distribution
#---------------------------------------------------------
a <- c(0.5,0.75,1.5,2,2.5)
b <- 1
alpha <- 2
p_GED <- function(a, b) {(1 - exp(-a / b))^alpha}
p <- p_GED(a, b)
repetitive_group_asip(
 p = p,
 c1 = 0,
 c2 = 2,
 beta = 0.25
)

#---------------------------------------------------------
# Example 3: Repetitive acceptance sampling plans for burr type XII percentiles
#---------------------------------------------------------
q=.10
al=2;
k=0.5;
u=( ((1/(1-q))^(1/k)) - 1)^(1/al)
a=c(0.5,1); ### a=t/the0
b=1;   ### b=the/the0
p= 1- ( 1+ ((u*a/b)^(al)) )^(-k)
repetitive_group_asip(
 p = p,
 c1 = 0,
 c2 = 1,
 beta = 0.25
)






Operating Characteristic Values for a Repetitive Group Acceptance Sampling Inspection Plan

Description

Calculates operating characteristic values for different quality ratios using the RGASIP design obtained at b = 1.

Usage

rgasip_oc(p_design, a, p_oc, b_oc, c1 = 0, c2 = 2, beta = 0.25, n.max = 500)

Arguments

p_design

Failure probabilities at the design condition b = 1.

a

Vector of termination ratios corresponding to p_design.

p_oc

Matrix of failure probabilities for different quality ratios. Each row corresponds to a value of a, and each column corresponds to a value of b_oc.

b_oc

Numeric vector of quality ratios corresponding to the columns of p_oc.

c1

Acceptance number.

c2

Rejection boundary. Rejection occurs when d > c2.

beta

Producer's risk.

n.max

Maximum sample size considered during the design optimization.

Details

For each termination ratio, the optimum sample size is first determined at b = 1 by minimizing ASN subject to the producer's risk constraint. The resulting sample size is then kept fixed while calculating the operating characteristic for different quality ratios.

The lot is accepted when d <= c1, rejected when d > c2, and the sampling procedure is repeated when c1 < d <= c2.

Value

A data frame containing the termination ratio, quality ratio, failure probability, design sample size, acceptance probability, repetition probability, rejection probability, eventual acceptance probability and ASN.

Examples


#---------------------------------------------------------
# Example 1: User-supplied failure probabilities
#---------------------------------------------------------

a <- c(0.5, 1, 1.5, 2)

# Failure probabilities at b = 1
p_design <- c(0.05, 0.10, 0.15, 0.20)

# Quality ratios
b_oc <- 2:6

# Example failure probabilities for different b values
p_oc <- sapply(
  b_oc,
  function(b) p_design / b
)

rgasip_oc(
  p_design = p_design,
  a = a,
  p_oc = p_oc,
  b_oc = b_oc,
  c1 = 0,
  c2 = 2,
  beta = 0.25,
  n.max = 100
)

#---------------------------------------------------------
# Example 2: Generalized Exponential distribution
#---------------------------------------------------------

alpha <- 2

a <- c(0.5, 0.75, 1, 1.5, 2)
b_oc <- 2:6

# Design failure probabilities at b = 1
p_design <- (1 - exp(-a))^alpha

# Failure probabilities at different quality ratios
p_oc <- sapply(
  b_oc,
  function(b)
    (1 - exp(-a / b))^alpha
)

rgasip_oc(
  p_design = p_design,
  a = a,
  p_oc = p_oc,
  b_oc = b_oc,
  c1 = 0,
  c2 = 2,
  beta = 0.25,
  n.max = 100
)

#---------------------------------------------------------
# Example 3: Weibull distribution
#---------------------------------------------------------

shape <- 2

a <- c(0.5, 0.75, 1, 1.5, 2)
b_oc <- 2:6

# Design failure probabilities at b = 1
p_design <- 1 - exp(-(a^shape))

# Failure probabilities at different quality ratios
p_oc <- sapply(
  b_oc,
  function(b)
    1 - exp(-((a / b)^shape))
)

rgasip_oc(
  p_design = p_design,
  a = a,
  p_oc = p_oc,
  b_oc = b_oc,
  c1 = 0,
  c2 = 2,
  beta = 0.25,
  n.max = 100
)

#---------------------------------------------------------
# Example 4: Repetitive acceptance sampling plans for burr type XII percentiles
#---------------------------------------------------------
q=.10
al=2;
k=0.5;
u=( ((1/(1-q))^(1/k)) - 1)^(1/al)
a <- c(0.5, 1)
b_oc <- 2:3
# Design failure probabilities at b = 1
p_design <- 1- ( 1+ ((u*a)^(al)) )^(-k)
# Failure probabilities at different quality ratios
p_oc <- sapply(
 b_oc,
 function(b)
   1- ( 1+ ((u*a/b)^(al)) )^(-k)
)


rgasip_oc(
 p_design = p_design,
 a = a,
 p_oc = p_oc,
 b_oc = b_oc,
 c1 = 0,
 c2 = 2,
 beta = 0.25,
 n.max = 100
)