Learn R Programming

tolerance (version 3.0.0)

bintol.int: Binomial Tolerance Intervals

Description

Provides 1-sided or 2-sided tolerance intervals for binomial random variables. From a statistical quality control perspective, these limits use the proportion of defective (or acceptable) items in a sample to bound the number of defective (or acceptable) items in future productions of a specified quantity.

Usage

bintol.int(x, n, m = NULL, alpha = 0.05, P = 0.99, side = 1, 
           method = c("LS", "WS", "AC", "JF", "CP", "AS", 
           "LO", "PR", "PO", "CL", "CC", "CWS"), 
           a1 = 0.5, a2 = 0.5)

Value

bintol.int returns a data frame with items:

alpha

The specified significance level.

P

The proportion of defective (or acceptable) units in future samples of size m.

p.hat

The proportion of defective (or acceptable) units in the sample, calculated by x/n.

1-sided.lower

The 1-sided lower tolerance bound. This is given only if side = 1.

1-sided.upper

The 1-sided upper tolerance bound. This is given only if side = 1.

2-sided.lower

The 2-sided lower tolerance bound. This is given only if side = 2.

2-sided.upper

The 2-sided upper tolerance bound. This is given only if side = 2.

Arguments

x

The number of defective (or acceptable) units in the sample. Can be a vector of length n, in which case the sum of x is used.

n

The size of the random sample of units selected for inspection.

m

The quantity produced in future groups. If m = NULL, then the tolerance limits will be constructed assuming n for this quantity.

alpha

The level chosen such that 1-alpha is the confidence level.

P

The proportion of the defective (or acceptable) units in future samples of size m to be covered by this tolerance interval.

side

Whether a 1-sided or 2-sided tolerance interval is required (determined by side = 1 or side = 2, respectively).

method

The method for calculating the lower and upper confidence bounds, which are used in the calculation of the tolerance bounds. The default method is "LS", which is the large-sample method. "WS" is Wilson's method, which is just the score confidence interval. "AC" gives the Agresti-Coull method, which is also appropriate when the sample size is large. "JF" is Jeffreys' method, which is a Bayesian approach to the estimation. "CP" is the Clopper-Pearson (exact) method, which is based on beta percentiles and provides a more conservative interval. "AS" is the arcsine method, which is appropriate when the sample proportion is not too close to 0 or 1. "LO" is the logit method, which also is appropriate when the sample proportion is not too close to 0 or 1, but yields a more conservative interval. "PR" uses a probit transformation and is accurate for large sample sizes. "PO" is based on a Poisson parameterization, but it tends to be more erratic compared to the other methods. "CL" is the complementary log transformation and also tends to perform well for large sample sizes. "CC" gives a continuity-corrected version of the large-sample method. "CWS" gives a continuity-corrected version of Wilson's method. More information on these methods can be found in the "References".

a1

This specifies the first shape hyperparameter when using Jeffreys' method.

a2

This specifies the second shape hyperparameter when using Jeffreys' method.

References

Brown, L. D., Cai, T. T., and DasGupta, A. (2001), Interval Estimation for a Binomial Proportion, Statistical Science, 16, 101--133.

Hahn, G. J. and Chandra, R. (1981), Tolerance Intervals for Poisson and Binomial Variables, Journal of Quality Technology, 13, 100--110.

Newcombe, R. G. (1998), Two-Sided Confidence Intervals for the Single Proportion: Comparison of Seven Methods, Statistics in Medicine, 17, 857--872.

See Also

Binomial, umatol.int

Examples

Run this code
## 85%/90% 2-sided binomial tolerance intervals for a future 
## lot of 2500 when a sample of 230 were drawn from a lot of 
## 1000.  All methods but Jeffreys' method are compared
## below.

bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "LS")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "WS")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "AC")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "CP")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "AS")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "LO")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "PR")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "PO")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "CL")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "CC")
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 2, method = "CWS")
           
## Using Jeffreys' method to construct the 85%/90% 1-sided 
## binomial tolerance limits.  The first calculation assumes 
## a prior on the proportion of defects which places greater
## density on values near 0.  The second calculation assumes
## a prior on the proportion of defects which places greater
## density on values near 1.

bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 1, method = "JF", a1 = 2, a2 = 10)
bintol.int(x = 230, n = 1000, m = 2500, alpha = 0.15, P = 0.90,
           side = 1, method = "JF", a1 = 5, a2 = 1)


 

Run the code above in your browser using DataLab