I'm about to conduct an experiment where I will measure a binary variable. I will test two different settings of a machine and then I want check whether these two settings yield different proportions in the observed binary variable by using a binomial test.
Obtaining samples from that machine is expensive (both in terms of time and money) so I would like to take as few samples as possible to reach the following goals:
- If the two settings actually yield different proportions (this is what I expect) then I want to reach a significance level of $p = 10^{-3}$ with the binomial test.
- I accept a maximum 1 out of 1,000 chance (i.e. 0.1%) that this significance level will not be reached due to unlucky sampling, even though the two proportions are actually different.
That means with a probability of 99.9% I want to reach a significance level of $10^{-3}$ when drawing $N$ samples. The question is how large should $N$ be to fulfill these requirements?
I have a numerical model of that machine which gives me access to the theoretical proportions under both settings (e.g. $p_1$ and $p_2$). I suppose these need to be used in order to estimate the minimum sample size $N$?