# power calculation for two stage binomial type model

This is a power-type calculation for a Bernoulli/binomial question in two stages.

Suppose you are planning an experiment which starts with a test for an event on $N$ experimental units. The event occurs with probability $p$ and you first record the number of times it occurs, $n \in \{ 0, 1, 2, \ldots, N \}$.

Suppose further that the full experiment can only continue if the number or events is less or equal to some limit $n_L$, that is $n \le n_L$.

The probability of being able to carry out the full experiment will thus depend on the probability of a single event $p$ which we can estimate independently in a separate experiment by a sequence of Bernoulli trials.

How may Bernoulli trials is this initial separate experiment, and with what results, would we need to ensure a $1-\beta$ chance of having $n \le n_L$ in the full experiment? Is there a simple way of doing this? Is there a sequential testing framework I could use?

Working forward is easy from a Bayesian prior of $p \sim Beta(1,1)$ to $Pr(n \le n_L)$ but it would be nice to have a way of working backwards.