Type: | Package |
Title: | Multi-State Reliability Demonstration Tests (MSRDT) |
Version: | 0.1.0 |
Maintainer: | Suiyao Chen <csycsy12377@gmail.com> |
Description: | This is a implementation of design methods for multi-state reliability demonstration tests (MSRDT) with failure count data, which is associated with the work from the published paper "Multi-state Reliability Demonstration Tests" by Suiyao Chen et al. (2017) <doi:10.1080/08982112.2017.1314493>. It implements two types of MSRDT, multiple periods (MP) and multiple failure modes (MFM). For MP, two different scenarios with criteria on cumulative periods (Cum) or separate periods (Sep) are implemented respectively. It also provides the implementation of conventional design method, namely binomial tests for failure count data. |
Depends: | R (≥ 3.3.0) |
License: | GPL-3 |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.1.0 |
Imports: | gtools, stats, reshape2, dplyr, utils |
Suggests: | tidyverse, knitr, rmarkdown |
URL: | https://github.com/ericchen12377/MSRDT |
BugReports: | https://github.com/ericchen12377/MSRDT/issues |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2020-05-26 13:46:06 UTC; chens |
Author: | Suiyao Chen [aut, cre] |
Repository: | CRAN |
Date/Publication: | 2020-06-02 10:00:02 UTC |
Binary Indicator for Multi-state RDT with Multiple Failure Modes (MFM)
Description
Define the binary indicator function to check whether the failure probability satisfies the lower level reliability requirements for each failure mode (for Multi-state RDT, Multiple Failure Models)
Usage
MFM_Indicator(pivec, Rvec)
Arguments
pivec |
Failure probability for each separate period. |
Rvec |
Lower level reliability requirements for each cumulative period from the begining of the test. |
Value
0 – No; 1 – Yes.
See Also
MFM_core
for getting the core probability of passting the test;
MFM_consumerrisk
for getting the consumer's risk;
MFM_optimal_n
for getting the optimal test sample size;
Other MSRDT for MFM functions:
MFM_consumerrisk()
,
MFM_core()
,
MFM_optimal_n()
Examples
MFM_Indicator(pivec = c(0.1, 0.2), Rvec = c(0.8, 0.6))
MFM_Indicator(pivec = c(0.1, 0.2, 0.1), Rvec = c(0.8, 0.6, 0.4))
MFM_Indicator(pivec = c(0.1, 0.4), Rvec = c(0.8, 0.7))
Consumer's Risk for Multi-state RDT with Multiple Failure Modes (MFM)
Description
Define the consumer risk function which gets the probability of passing the test when the lower level reliability requirements are not satisfied under different failure modes (for Multi-state RDT, Multiple Failure Modes).
Usage
MFM_consumerrisk(n, cvec, pivec, Rvec)
Arguments
n |
RDT sample size |
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Rvec |
Lower level reliability requirements for each cumulative period from the begining of the test. |
Value
Probability for consumer's risk
See Also
MFM_core
for getting the core probability of passting the test;
MFM_Indicator
for getting the binary indicator;
MFM_optimal_n
for getting the optimal test sample size;
Other MSRDT for MFM functions:
MFM_Indicator()
,
MFM_core()
,
MFM_optimal_n()
Examples
pi1 <- pi_MCSim_beta(M = 1000, seed = 10, a = 1, b = 1)
pi2 <- pi_MCSim_beta(M = 1000, seed = 10, a = 2, b = 18)
MFM_consumerrisk(n = 10, cvec = c(1, 1), pivec = cbind(pi1, pi2), Rvec = c(0.8, 0.7))
Probability Core for Multi-state RDT with Multiple Failure Modes (MFM)
Description
Define the summed core function inside of the integration which gets the probability of passing the test given specific failure probabilities under different failure modes (for Multi-state RDT, Multiple Failure Modes).
Usage
MFM_core(n, cvec, pivec)
Arguments
n |
RDT sample size |
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Value
Core probability of passing the test given specific failure probabilities
See Also
MFM_consumerrisk
for getting the consumer's risk;
MFM_Indicator
for getting the binary indicator;
MFM_optimal_n
for getting the optimal test sample size;
Other MSRDT for MFM functions:
MFM_Indicator()
,
MFM_consumerrisk()
,
MFM_optimal_n()
Examples
#' #Example for two failure modes
pi1 <- pi_MCSim_beta(M = 1000, seed = 10, a = 1, b = 1)
pi2 <- pi_MCSim_beta(M = 1000, seed = 10, a = 2, b = 18)
MFM_core(n = 10, cvec = c(1, 1), pivec = c(pi1[1], pi2[1]));
#The function also works for more than two failure modes.
#However, the computation cost may increase.
#Example for three failure modes
MFM_core(n = 10, cvec = c(1, 1, 1), pivec = c(0.8, 0.9, 0.8));
Optimal Test Sample Size for Multi-state RDT with Multiple Failure Modes (MFM)
Description
Define the optimal function to find the optimal test plan with minimum test sample size given an acceptable level of consumer's risk (for Multi-state RDT, Multiple Failure Modes).
Usage
MFM_optimal_n(cvec, pivec, Rvec, thres_CR)
Arguments
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Rvec |
Lower level reliability requirements for each cumulative period from the begining of the test. |
thres_CR |
Threshold (acceptable level) of consumer's risk |
Value
Minimum test sample size
See Also
MFM_core
for getting the core probability of passting the test;
MFM_consumerrisk
for getting the consumer's risk;
MFM_Indicator
for getting the binary indicator;
Other MSRDT for MFM functions:
MFM_Indicator()
,
MFM_consumerrisk()
,
MFM_core()
Examples
pi1 <- pi_MCSim_beta(M = 5000, seed = 10, a = 1, b = 1)
pi2 <- pi_MCSim_beta(M = 5000, seed = 10, a = 2, b = 18)
MFM_optimal_n(cvec = c(1, 1), pivec = cbind(pi1, pi2), Rvec = c(0.8, 0.7), thres_CR = 0.05)
Consumer's Risk for Multi-state RDT with Multiple Periods and Criteria for Cumulative Periods
Description
Define the consumer risk function which gets the probability of passing the test when the lower level reliability requirements are not satisfied for any cumulative periods. The maximum allowable failures for each cumulative period need to be satisfied to pass the test (for Multi-state RDT, Multiple Periods, Scenario I)
Usage
MPCum_consumerrisk(n, cvec, pivec, Rvec)
Arguments
n |
RDT sample size |
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Rvec |
Lower level reliability requirements for each cumulative period from the begining of the test. |
Value
Probability for consumer's risk
Examples
pi <- pi_MCSim_dirichlet(M = 1000, seed = 10, par = c(1, 1, 1))
MPCum_consumerrisk(n = 10, cvec = c(1, 1), pivec = pi, Rvec = c(0.8, 0.7))
Probability Core for Multi-state RDT with Multiple Periods and Criteria for Cumulative Periods
Description
Define the summed core function inside of the integration which gets the probability of passing the test given specific failure probabilities. The maximum allowable failures for each cumulative period need to be satisfied to pass the test (for Multi-state RDT, Multiple Periods, Scenario I).
Usage
MPCum_core(n, cvec, pivec)
Arguments
n |
RDT sample size |
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Value
Core probability of passing the test given specific failure probabilities
Examples
#Example for two periods
pi <- pi_MCSim_dirichlet(M = 1000, seed = 10, par = c(1, 1, 1))
MPCum_core(n = 10, cvec = c(1, 1), pivec = pi[1, ]);
#The function also works for more than two periods, however, may increase the computation cost.
#Example for three periods
pi <- pi_MCSim_dirichlet(M = 1000, seed = 10, par = c(1, 1, 1, 1))
MPCum_core(n = 10, cvec = c(1, 1, 1), pivec = pi[1, ]);
Optimal Test Sample Size for Multi-state RDT with Multiple Periods and Criteria for Cumulative Periods
Description
Define the optimal function to find the optimal test plan with minimum test sample size given an acceptable level of consumer's risk. The maximum allowable failures for each cumulative period need to be satisfied to pass the test (for Multi-state RDT, Multiple Periods, Scenario I)
Usage
MPCum_optimal_n(cvec, pivec, Rvec, thres_CR)
Arguments
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Rvec |
Lower level reliability requirements for each cumulative period from the begining of the test. |
thres_CR |
Threshold (acceptable level) of consumer's risk |
Value
Minimum test sample size
Examples
pi <- pi_MCSim_dirichlet(M = 5000, seed = 10, par = c(1, 1, 1))
MPCum_optimal_n(cvec = c(1,1), pivec = pi, Rvec = c(0.8, 0.7), thres_CR = 0.05)
Consumer's Risk for Multi-state RDT with Multiple Periods and Criteria for Separate Periods
Description
Define the consumer risk function hich gets the probability of passing the test when the lower level reliability requirements are not satisfied for any cumulative periods. The maximum allowable failures for each separate period need to be satisfied to pass the test (for Multi-state RDT, Multiple Periods, Scenario I)
Usage
MPSep_consumerrisk(n, cvec, pivec, Rvec)
Arguments
n |
RDT sample size |
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Rvec |
Lower level reliability requirements for each cumulative period from the begining of the test. |
Value
Probability for consumer's risk
Examples
pi <- pi_MCSim_dirichlet(M = 1000, seed = 10, par = c(1, 1, 1))
MPSep_consumerrisk(n = 10, cvec = c(1, 1), pi = pi, Rvec = c(0.8, 0.7))
Probability Core for Multi-state RDT with Multiple Periods and Criteria for Separate Periods
Description
Define the summed core function inside of the integration which gets the probability of passing the test given specific failure probabilities. The maximum allowable failures for each separate period need to be satisfied to pass the test (for Multi-state RDT, Multiple Periods, Scenario II).
Usage
MPSep_core(n, cvec, pivec)
Arguments
n |
RDT sample size |
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Value
Core probability of passing the test given specific failure probabilities
Examples
#Example for two periods
pi <- pi_MCSim_dirichlet(M = 1000, seed = 10, par = c(1, 1, 1))
MPSep_core(n = 10, cvec = c(1, 1), pivec = pi[1, ]);
#The function also works for more than two periods, however, may increase the computation cost.
#Example for three periods
pi <- pi_MCSim_dirichlet(M = 1000, seed = 10, par = c(1, 1, 1, 1))
MPSep_core(n = 10, cvec = c(1, 1, 1), pivec = pi[1, ]);
Optimal Test Sample Size for Multi-state RDT with Multiple Periods and Criteria for Separate Periods
Description
Define the optimal function to find the optimal test plan with minimum test sample size given an acceptable level of consumer's risk. The maximum allowable failures for each separate period need to be satisfied to pass the test (for Multi-state RDT, Multiple Periods, Scenario I)
Usage
MPSep_optimal_n(cvec, pivec, Rvec, thres_CR)
Arguments
cvec |
Maximum allowable failures for each separate period |
pivec |
Failure probability for each seperate period |
Rvec |
Lower level reliability requirements for each cumulative period from the begining of the test. |
thres_CR |
Threshold (acceptable level) of consumer's risk |
Value
Minimum test sample size
Examples
pi <- pi_MCSim_dirichlet(M = 5000, seed = 10, par = c(1, 1, 1))
MPSep_optimal_n(cvec = c(1, 1), pivec = pi, Rvec = c(0.8, 0.7), thres_CR = 0.05)
Binary Indicator for Multi-state RDT with Multiple Periods
Description
Define the binary indicator function to check whether the failure probability satisfies the lower level reliability requirements for each cumulative period (for Multi-state RDT, Multiple Periods)
Usage
MP_Indicator(pivec, Rvec)
Arguments
pivec |
Failure probability for each separate period. |
Rvec |
Lower level reliability requirements for each cumulative period from the begining of the test. |
Value
0 – No; 1 – Yes.
Examples
MP_Indicator(pivec = c(0.1, 0.2), Rvec = c(0.8, 0.6))
MP_Indicator(pivec = c(0.1, 0.2, 0.1), Rvec = c(0.8, 0.6, 0.4))
MP_Indicator(pivec = c(0.1, 0.3), Rvec = c(0.8, 0.7))
Binary Indicator for Binomial RDT
Description
Define the binary indicator function to check whether the failure probability satisfies the lower level reliability requirement (for binomial RDT).
Usage
bIndicator(pi, R)
Arguments
pi |
Failure probability. |
R |
Lower Level reliability requirement. |
Value
0 – No; 1 – Yes.
See Also
bcore
for getting the core probability of passting the test;
boptimal_n
for getting the optimal test sample size;
bconsumerrisk
for getting the consumer's risk;
Other Binomial RDT functions:
bconsumerrisk()
,
bcore()
,
boptimal_n()
Examples
bIndicator(pi = 0.05, R = 0.9)
bIndicator(pi = 0.2, R = 0.9)
Consumer's Risk for Binomial RDT
Description
Define the consumer's risk function which gets the probability of passing the test when the lower level reliability requirement is not satisfied (for binomial RDT).
Usage
bconsumerrisk(n, c, pi, R)
Arguments
n |
RDT sample size. |
c |
Maximum allowable failures. |
pi |
Failure probability. |
R |
Lower level reliability requirement. |
Value
Probability of consumer's risk
See Also
bcore
for getting the core probability of passting the test;
boptimal_n
for getting the optimal test sample size;
bIndicator
for getting the binary indicator;
Other Binomial RDT functions:
bIndicator()
,
bcore()
,
boptimal_n()
Examples
pi <- pi_MCSim_beta(M = 1000, seed = 10, a = 1, b = 1)
bconsumerrisk(n = 10, c = 2, pi = pi, R = 0.8);
Probability Core for Binomial RDT
Description
Define the summed core function inside of the integration which gets the probability of passing the test given specific failure probabilities (for binomial RDT).
Usage
bcore(n, c, pi)
Arguments
n |
RDT sample size. |
c |
Maximum allowable failures. |
pi |
Failure probability. |
Value
Core probability of passing the test given specific failure probabilities.
See Also
boptimal_n
for getting the optimal test sample size;
bconsumerrisk
for getting the consumer's risk;
bIndicator
for getting the binary indicator;
Other Binomial RDT functions:
bIndicator()
,
bconsumerrisk()
,
boptimal_n()
Examples
bcore(n = 10, c = 2, pi = 0.2)
Optimal Test Sample Size for Binomial RDT
Description
Define the optimal function to find the optimal test plan with minimum test sample size given an acceptable level of consumer's risk (for binomial RDT).
Usage
boptimal_n(c, pi, R, thres_CR)
Arguments
c |
Maximum allowable failures |
pi |
Failure probability |
R |
Lower level reliability requirement |
thres_CR |
Threshold (acceptable level) of consumer's risk |
Value
Minimum test sample size
See Also
bcore
for getting the core probability of passting the test;
bconsumerrisk
for getting the consumer's risk;
bIndicator
for getting the binary indicator;
Other Binomial RDT functions:
bIndicator()
,
bconsumerrisk()
,
bcore()
Examples
pi <- pi_MCSim_beta(M = 5000, seed = 10, a = 1, b = 1)
boptimal_n(c = 2, pi = pi, R = 0.8, thres_CR = 0.05)
Beta Prior Simulation for Binomial RDT
Description
Define the simulation function to generate failure probability with Beta prior distributions as conjugate prior to binomial distributions (for binomial RDT).
Usage
pi_MCSim_beta(M, seed, a, b)
Arguments
M |
Simulation sample size |
seed |
Random seed for random sample |
a |
Shape parameter 1 for beta distribution |
b |
Shape parameter 2 for beta distribution |
Value
Vector of failure probability sample values
See Also
Other Prior distribution generation functions:
pi_MCSim_dirichlet()
Examples
pi <- pi_MCSim_beta(M = 1000, seed = 10, a = 1, b = 1)
Dirichlet Prior Simulation for Multi-state RDT
Description
Define the simulation function to generate failure probability with Dirichlet prior distributions as conjugate prior to multinomial distributions (for multi-state RDT).
Usage
pi_MCSim_dirichlet(M, seed, par)
Arguments
M |
Simulation sample size |
seed |
Random seed for random sample |
par |
Parameters for dirichlet distribution |
Value
Vector of failure probability sample
See Also
Other Prior distribution generation functions:
pi_MCSim_beta()
Examples
pi <- pi_MCSim_dirichlet(M = 1000, seed = 10, par = c(1, 1, 1))