- #1

estebanox

- 26

- 0

**Problem:**

Suppose I have a production process that yields output in batches of

*n*items. For each batch, I can test whether they are of good or bad quality. Let

*q_i ∈ {1,0}*be the quality of tested item

*i*.

If more than half of the items are ‘bad’, the batch should be discarded. In other words: the batch should be discarded if the average quality of items is

*q(n)<0.5.*

Suppose testing is sequential (i.e. you learn the quality of items one at the time), and each test is a random draw from a Bernoulli distribution with unknown mean

*p*.I would like to know when to stop testing items in a batch, in order to decide whether to discard it without testing all items, and yet be statistically confident that the outcome (discard vs not discard) is the same as the one that would have been reached if all items had been tested.

**What I currently have:**

If I knew

*p*, I could use a normal approximation to estimate the confidence interval of the binomial proportion

*q(k)*for any

*k*. With this, for any arbitrary width of the interval, I could calculate the number of tests that are required to achieve a given confidence level (let me call such number of tests

*k**).

Since I don’t know

*p*, one option would be to solve for

*k**assuming the worst case scenario (i.e.

*p=0.5*). This was proposed (and discussed) in a related question here. Another similar alternative was proposed here.

This approach, however, does not take into account that

*n*is finite, so once many items have been tested, it becomes very unlikely that one more test will swing the outcome...