This function calculates the probability of exactly l
contaminated samples out of t
selected grab samples for given gram sample size r
and serial correlation d
at the process contamination level p
for a production length of N
.
prob_contaminant(l, r, t, d, p, N, method)
number of contaminated in t
selected samples
number of primary increments in a grab sample or grab sample size
number of grab samples
serial correlation of contamination between the primary increments
limiting fraction or proportion of contaminated increments
length of the production
what sampling method we have applied such as 'systematic'
or 'random'
selection methods
Probability of contaminated
Let St be the number of contaminated samples and St=∑Xt where Xt=1 or 0 depending on the presence or absence of contamination, then P(St=l) formula given in Bhat and Lal (1988), also we can use following recurrence relation formula, P(St=l)=P(Xt=1;St−1=l−1)+P(Xt=0;St−1=l) which is given in Vellaisamy and Sankar (2001). Both methods will be produced the same results. For this package development, we directly applied formula which is from Bhat and Lal (1988).
l <- 1
r <- 25
t <- 30
d <- 0.99
p <- 0.005
N <- 1e9
method <- 'systematic'
prob_contaminant(l, r, t, d, p, N, method)
#> [1] 0.1499949