| Title: | Modified Chain Sampling Inspection Plan for Time-Truncated Life Tests |
|---|---|
| Description: | Designing and comparing modified chain sampling inspection plan (MChSP). This package implements ChSP-1, MChSP-1, Multiple Dependent State Sampling (MDS), and Modified Chain Sampling plans (MChSP). The plans use user-supplied failure probabilities and determine the minimum sample size subject to consumer's risk constraints. Functions are provided to compare the required sample sizes of the four plans and visualize their performance. The distribution-free formulation allows the methods to be used with different lifetime distributions. Luca (2018) <doi:10.1080/02664763.2017.1375084>; Tripathi et al. (2021) <doi:10.32604/csse.2021.015624>; Tripathi et al. (2023) <doi:10.1007/s41872-023-00215-9>; Rao et al. (2025) <doi:10.1080/27684520.2025.2531810>; Tripathi and Saha (2023) <doi:10.1007/s13198-023-02221-7>. |
| Authors: | Harsh Tripathi [aut, cre] |
| Maintainer: | Harsh Tripathi <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-10-09 16:47:06 UTC |
| Source: | https://github.com/cran/rMCHSPTT |
Calculates the minimum required sample size for a Chain Sampling Inspection Plan (ChSP-1) under a time-truncated life test.
chsp1_asip(p, a, b, i = 1, beta = 0.25, n_max = 10000)chsp1_asip(p, a, b, i = 1, beta = 0.25, n_max = 10000)
p |
User-defined probability of failure before the termination time. It must lie strictly between 0 and 1. |
a |
Termination ratio, defined as a = t/theta0. It must be a positive numeric value. |
b |
Quality ratio, defined as b = theta/theta0. It must be a positive numeric value. |
i |
Number of preceding samples considered in the chain. It must be a positive integer. |
beta |
Consumer's risk. It must be a value between 0 and 1. |
n_max |
Maximum sample size to be searched. It must be a positive integer. |
The probability of failure before the termination time is supplied directly by the user through 'p'. Therefore, the function is distribution-free and can be used with different lifetime distributions.
For a sample of size 'n', let 'P0' denote the probability of observing zero defective units and 'P1' denote the probability of observing exactly one defective unit:
and
According to the attribute-case ChSP-1 plan, the probability of acceptance is
where 'i' is the number of preceding samples considered in the chain.
The function determines the minimum sample size 'n' satisfying the consumer's risk condition
The lifetime distribution is not embedded in the function. The user calculates the failure probability 'p' from the required lifetime distribution and supplies it to the function.
A data frame containing 'a', 'b', 'p', 'i', 'beta', the probabilities 'P0' and 'P1', the required sample size 'n', and the probability of acceptance 'Pa'.
# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c(0.05, 0.10, 0.15, 0.20) chsp1_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) chsp1_asip( p = p, a = a, b = b, i = 3, beta = 0.25 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha chsp1_asip( p = p, a = a, b = b, i = 3, beta = 0.25 )# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c(0.05, 0.10, 0.15, 0.20) chsp1_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) chsp1_asip( p = p, a = a, b = b, i = 3, beta = 0.25 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha chsp1_asip( p = p, a = a, b = b, i = 3, beta = 0.25 )
Compares the minimum required sample sizes of four attribute sampling inspection plans: ChSP-1, MChSP-1, MDS and MChSP under a time-truncated life test.
compare_chain_plans( p, a, b, i_ChSP1 = 1, i_MChSP1 = 1, i_MDS = 1, i_MChSP = 1, beta = 0.25, c1 = 0, c2 = 1, c = 1, n_max = 10000 )compare_chain_plans( p, a, b, i_ChSP1 = 1, i_MChSP1 = 1, i_MDS = 1, i_MChSP = 1, beta = 0.25, c1 = 0, c2 = 1, c = 1, n_max = 10000 )
p |
User-defined probability of failure before the termination time. It must lie strictly between 0 and 1. |
a |
Termination ratio, defined as a = t/theta0. It must be a positive numeric value. |
b |
Quality ratio, defined as b = theta/theta0. It must be a positive numeric value. |
i_ChSP1 |
Number of preceding samples or lots considered in the chain for ChSP-1. It must be a positive integer. |
i_MChSP1 |
Number of preceding samples or lots considered in the chain for MChSP-1. It must be a positive integer. |
i_MDS |
Number of preceding samples or lots considered in the chain for MDS. It must be a positive integer. |
i_MChSP |
Number of preceding samples or lots considered in the chain for MChSP. It must be a positive integer. |
beta |
Consumer's risk. It must be a value between 0 and 1. |
c1 |
First acceptance number for the MDS plan. It must be a non-negative integer. |
c2 |
Second acceptance number for the MDS plan. It must be an integer greater than or equal to 'c1'. |
c |
Acceptance number for the MChSP plan. It must be a non-negative integer. |
n_max |
Maximum sample size to be searched. It must be a positive integer. |
The probability of failure before the termination time is supplied directly by the user through 'p'. Therefore, the sampling-plan calculations are distribution-free and can be used with different lifetime distributions.
All four plans are designed using the single consumer's risk constraint
For ChSP-1, the probability of acceptance is
where
and
For MChSP-1, the probability of acceptance is
For MDS, define
and
The probability of acceptance satisfies
For MChSP, let
The probability of acceptance is
The function searches for the minimum sample size satisfying the consumer's risk constraint for each plan.
A data frame containing the design parameters, the user-specified chain lengths, minimum sample sizes and probabilities of acceptance for ChSP-1, MChSP-1, MDS and MChSP.
# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c( 0.02, 0.04, 0.06, 0.08, 0.10, 0.12, 0.14, 0.16 ) compare_chain_plans( p = p, a = c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25 ), b = 1, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) compare_chain_plans( p = p, a = a, b = b, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha compare_chain_plans( p = p, a = a, b = b, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 )# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c( 0.02, 0.04, 0.06, 0.08, 0.10, 0.12, 0.14, 0.16 ) compare_chain_plans( p = p, a = c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25 ), b = 1, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) compare_chain_plans( p = p, a = a, b = b, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha compare_chain_plans( p = p, a = a, b = b, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 )
Calculates the minimum required sample size for a Modified Chain Sampling Inspection Plan (MChSP) for inspection by attributes under a time-truncated life test.
mchsp_asip(p, a, b, i = 1, beta = 0.25, c = 0, n_max = 10000)mchsp_asip(p, a, b, i = 1, beta = 0.25, c = 0, n_max = 10000)
p |
User-defined probability of failure before the termination time. It must lie strictly between 0 and 1. |
a |
Termination ratio, defined as a = t/theta0. It must be a positive numeric value. |
b |
Quality ratio, defined as b = theta/theta0. It must be a positive numeric value. |
i |
Number of preceding lots considered in the chain. It must be a positive integer. |
beta |
Consumer's risk. It must be a value between 0 and 1. |
c |
Acceptance criterion. It must be a non-negative integer. |
n_max |
Maximum sample size to be searched. It must be a positive integer. |
The probability of failure before the termination time is supplied directly by the user through 'p'. Therefore, the function is distribution-free.
The MChSP plan for attributes is specified by the three integers '(n, c, i)', where 'n' is the sample size, 'c' is the acceptance criterion and 'i' is the number of preceding lots considered.
Let 'D' denote the number of defective units in a sample. Under a binomial model,
Define
The acceptance probability of the MChSP plan is
The function determines the minimum sample size 'n' satisfying
For 'c = 0', the MChSP plan is related to the MChSP-1 plan.
A data frame containing 'a', 'b', 'p', 'i', 'beta', 'c', 'm', the required sample size 'n', and the probability of acceptance 'Pa'.
# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c(0.05, 0.10, 0.15, 0.20) mchsp_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25, c = 0 ) # ---------------------------------------------------------- # Example 2: MChSP with c = 1 # ---------------------------------------------------------- mchsp_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25, c = 1 ) # ---------------------------------------------------------- # Example 3: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) mchsp_asip( p = p, a = a, b = b, i = 3, beta = 0.25, c = 1 ) # ---------------------------------------------------------- # Example 4: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha mchsp_asip( p = p, a = a, b = b, i = 3, beta = 0.25, c = 1 )# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c(0.05, 0.10, 0.15, 0.20) mchsp_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25, c = 0 ) # ---------------------------------------------------------- # Example 2: MChSP with c = 1 # ---------------------------------------------------------- mchsp_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25, c = 1 ) # ---------------------------------------------------------- # Example 3: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) mchsp_asip( p = p, a = a, b = b, i = 3, beta = 0.25, c = 1 ) # ---------------------------------------------------------- # Example 4: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha mchsp_asip( p = p, a = a, b = b, i = 3, beta = 0.25, c = 1 )
Calculates operating characteristic (OC) values for a Modified Chain Sampling Inspection Plan (MChSP).
mchsp_oc(p_design, a, p_oc, b_oc, i = 1, beta = 0.25, c = 0, n_max = 10000)mchsp_oc(p_design, a, p_oc, b_oc, i = 1, beta = 0.25, c = 0, n_max = 10000)
p_design |
Failure probability at the design condition. It must lie strictly between 0 and 1. |
a |
Termination ratio, defined as 'a = t/theta0'. |
p_oc |
Matrix or data frame of failure probabilities used for OC calculation. Rows correspond to 'a' and columns correspond to 'b_oc'. |
b_oc |
Quality ratios used for OC calculation. |
i |
Number of preceding lots considered in the MChSP plan. |
beta |
Consumer's risk. It must be between 0 and 1. |
c |
Acceptance criterion. It must be a non-negative integer. |
n_max |
Maximum sample size searched at the design condition. |
The sample size is first determined at the design condition using 'p_design' and the constraint 'Pa <= beta'. The resulting sample size is then kept fixed while 'p_oc' is used to calculate the probability of acceptance for the quality ratios in 'b_oc'.
Let
The resulting 'Pa' values are the OC values for the specified quality ratios.
A data frame containing 'a', 'b', 'p', 'i', 'beta', 'c', fixed 'n', 'ASN', 'm', and 'Pa'. The 'Pa' values are the OC values.
a <- c(0.5, 1, 1.5, 2) p_design <- c(0.05, 0.10, 0.15, 0.20) b_oc <- 2:12 p_oc <- outer( a, b_oc, function(a, b) pmin(0.95, a / (10 * b)) ) mchsp_oc( p_design = p_design, a = a, p_oc = p_oc, b_oc = b_oc, i = 3, beta = 0.25, c = 0 )a <- c(0.5, 1, 1.5, 2) p_design <- c(0.05, 0.10, 0.15, 0.20) b_oc <- 2:12 p_oc <- outer( a, b_oc, function(a, b) pmin(0.95, a / (10 * b)) ) mchsp_oc( p_design = p_design, a = a, p_oc = p_oc, b_oc = b_oc, i = 3, beta = 0.25, c = 0 )
Calculates the minimum required sample size for a Modified Chain Sampling Inspection Plan (MChSP-1) under a time-truncated life test.
mchsp1_asip(p, a, b, i = 1, beta = 0.25, n_max = 10000)mchsp1_asip(p, a, b, i = 1, beta = 0.25, n_max = 10000)
p |
User-defined probability of failure before the termination time. It must lie strictly between 0 and 1. |
a |
Termination ratio, defined as a = t/theta0. It must be a positive numeric value. |
b |
Quality ratio, defined as b = theta/theta0. It must be a positive numeric value. |
i |
Number of preceding samples considered in the chain. It must be a positive integer. |
beta |
Consumer's risk. It must be a value between 0 and 1. |
n_max |
Maximum sample size to be searched. It must be a positive integer. |
The probability of failure before the termination time is supplied directly by the user through 'p'. Therefore, the function is distribution-free.
Let
denote the probability of observing zero defective units and
denote the probability of observing exactly one defective unit.
For the attribute-case MChSP-1 plan, the probability of acceptance is
where 'i' is the number of preceding samples considered in the chain.
The function determines the minimum sample size 'n' satisfying
A data frame containing 'a', 'b', 'p', 'i', 'beta', the probabilities 'P0' and 'P1', the required sample size 'n', and the probability of acceptance 'Pa'.
# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c(0.05, 0.10, 0.15, 0.20) mchsp1_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) mchsp1_asip( p = p, a = a, b = b, i = 3, beta = 0.25 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha mchsp1_asip( p = p, a = a, b = b, i = 3, beta = 0.25 )# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c(0.05, 0.10, 0.15, 0.20) mchsp1_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) mchsp1_asip( p = p, a = a, b = b, i = 3, beta = 0.25 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha mchsp1_asip( p = p, a = a, b = b, i = 3, beta = 0.25 )
Calculates the minimum required sample size for an MDS plan for inspection by attributes under a time-truncated life test.
mds_asip(p, a, b, i = 1, beta = 0.25, c1 = 0, c2 = 1, n_max = 10000)mds_asip(p, a, b, i = 1, beta = 0.25, c1 = 0, c2 = 1, n_max = 10000)
p |
User-defined probability of failure before the termination time. It must lie strictly between 0 and 1. |
a |
Termination ratio, defined as a = t/theta0. It must be a positive numeric value. |
b |
Quality ratio, defined as b = theta/theta0. It must be a positive numeric value. |
i |
Number of preceding samples considered in the MDS plan. In the new formulation, 'i' represents the exponent 'm' in 'P_a=A+B A^m'. |
beta |
Consumer's risk. It must be a value between 0 and 1. |
c1 |
First acceptance number. It must be a non-negative integer. |
c2 |
Second acceptance number. It must be an integer greater than or equal to 'c1'. |
n_max |
Maximum sample size to be searched. It must be a positive integer. |
The probability of failure before the termination time is supplied directly by the user through 'p'. Therefore, the sampling-plan calculation is distribution-free.
The MDS plan is specified by '(n, c1, c2, i)'.
Let D denote the number of defective units in a sample. Under the binomial model,
Define
and
The new MDS acceptance probability is
where 'm' is the number of preceding samples. In this implementation, the existing argument 'i' is retained for compatibility and represents 'm'.
Equivalently,
The function determines the minimum sample size 'n' satisfying
A data frame containing 'a', 'b', 'p', 'i', 'beta', 'c1', 'c2', the probabilities 'A' and 'B', the required sample size 'n', and the probability of acceptance 'Pa'.
# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c(0.05, 0.10, 0.15, 0.20) mds_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25, c1 = 0, c2 = 1 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) mds_asip( p = p, a = a, b = b, i = 3, beta = 0.25, c1 = 0, c2 = 1 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha mds_asip( p = p, a = a, b = b, i = 3, beta = 0.25, c1 = 0, c2 = 1 )# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c(0.05, 0.10, 0.15, 0.20) mds_asip( p = p, a = c(0.5, 1, 1.5, 2), b = 1, i = 3, beta = 0.25, c1 = 0, c2 = 1 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) mds_asip( p = p, a = a, b = b, i = 3, beta = 0.25, c1 = 0, c2 = 1 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha mds_asip( p = p, a = a, b = b, i = 3, beta = 0.25, c1 = 0, c2 = 1 )
Produces a comparison plot of the minimum sample sizes required by ChSP-1, MChSP-1, MDS and MChSP.
plot_chain_plans( p, a, b, i_ChSP1 = 1, i_MChSP1 = 1, i_MDS = 1, i_MChSP = 1, beta = 0.25, c1 = 0, c2 = 1, c = 1, n_max = 10000, ylim = NULL )plot_chain_plans( p, a, b, i_ChSP1 = 1, i_MChSP1 = 1, i_MDS = 1, i_MChSP = 1, beta = 0.25, c1 = 0, c2 = 1, c = 1, n_max = 10000, ylim = NULL )
p |
User-defined probability of failure before the termination time. It must lie strictly between 0 and 1. |
a |
Termination ratio, defined as a = t/theta0. It must be a positive numeric value. |
b |
Quality ratio, defined as b = theta/theta0. It must be a positive numeric value. |
i_ChSP1 |
Number of preceding samples or lots considered in the chain for ChSP-1. It must be a positive integer. |
i_MChSP1 |
Number of preceding samples or lots considered in the chain for MChSP-1. It must be a positive integer. |
i_MDS |
Number of preceding samples or lots considered in the chain for MDS. It must be a positive integer. |
i_MChSP |
Number of preceding samples or lots considered in the chain for MChSP. It must be a positive integer. |
beta |
Consumer's risk. It must be a value between 0 and 1. |
c1 |
First acceptance number for MDS. |
c2 |
Second acceptance number for MDS. |
c |
Acceptance number for MChSP. |
n_max |
Maximum sample size to be searched. |
ylim |
Numeric vector of length two specifying the limits of the y-axis. Default is 'NULL'. |
The probability of failure before the termination time is supplied by the user through 'p'.
The x-axis represents the termination ratio
and the y-axis represents the minimum
required sample size.
All plans satisfy the common consumer's risk constraint
The comparison data frame is returned invisibly. The function also produces the comparison plot.
# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c( 0.02, 0.04, 0.06, 0.08, 0.10, 0.12, 0.14, 0.16 ) a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25 ) plot_chain_plans( p = p, a = a, b = 1, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) plot_chain_plans( p = p, a = a, b = b, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 0.5 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha plot_chain_plans( p = p, a = a, b = b, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 )# ---------------------------------------------------------- # Example 1: User-defined failure probabilities # ---------------------------------------------------------- p <- c( 0.02, 0.04, 0.06, 0.08, 0.10, 0.12, 0.14, 0.16 ) a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25 ) plot_chain_plans( p = p, a = a, b = 1, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 ) # ---------------------------------------------------------- # Example 2: Weibull distribution # ---------------------------------------------------------- shape <- 2 b <- 1 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- 1 - exp( -((a / b)^shape) ) plot_chain_plans( p = p, a = a, b = b, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 ) # ---------------------------------------------------------- # Example 3: Generalized Exponential distribution # Scale parameterization # ---------------------------------------------------------- alpha <- 2 b <- 0.5 a <- c( 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2 ) p <- ( 1 - exp(-a / b) )^alpha plot_chain_plans( p = p, a = a, b = b, i_ChSP1 = 1, i_MChSP1 = 2, i_MDS = 3, i_MChSP = 4, beta = 0.25, c1 = 0, c2 = 1, c = 1 )
Produces a base R OC curve using the 'Pa' values returned by 'mchsp_oc()'.
plot_mchsp_oc(x, ...)plot_mchsp_oc(x, ...)
x |
Output from 'mchsp_oc()'. |
... |
Additional graphical arguments passed to 'plot()'. |
Different termination ratios 'a' are distinguished using different plotting symbols and line types.
Invisibly returns the supplied data frame.
a <- c(0.5, 1, 1.5, 2) p_design <- c(0.05, 0.10, 0.15, 0.20) b_oc <- 2:12 p_oc <- sapply( b_oc, function(b) a / (10 * b) ) result <- mchsp_oc( p_design = p_design, a = a, p_oc = p_oc, b_oc = b_oc, i = 3, beta = 0.25, c = 0 ) plot_mchsp_oc(result)a <- c(0.5, 1, 1.5, 2) p_design <- c(0.05, 0.10, 0.15, 0.20) b_oc <- 2:12 p_oc <- sapply( b_oc, function(b) a / (10 * b) ) result <- mchsp_oc( p_design = p_design, a = a, p_oc = p_oc, b_oc = b_oc, i = 3, beta = 0.25, c = 0 ) plot_mchsp_oc(result)