How can one perform a two-group binomial power analysis without using normal approximations?

I would like to do power analyses for hypothesis tests of (non-)equality of proportions in which the proportions are very small. I would like to do so without using normal (or Poisson) approximations of the binomial distribution. There are several general types of power questions I'd like to be able to address.

1. Post-hoc: Given $\Pr_1$ (probability of a success in group 1) and $\Pr_2$ and $N_1$ (sample size group 1) and $N_2$ to calculate the power of the design given $\alpha$.
2. A priori solve for $N$ given $\alpha$, the ratio $N_1\over{N_2}$, $1 - \beta$ (power), $\alpha$, $\Pr_1$, and an expected $\Pr_2$
3. A priori solve for $1 - \beta$ given $\alpha, N_1, N_2, \Pr_1$, and $\Pr_2$.

An ideal response would include R code and point out any other givens that I forgot to point out. A simulation approach is not a suitable response due to the small proportions. With your solution, please also mention what kind of statistical test it is applicable to.

• One very general way to deal w/ these is via simulation. See, e.g., my answer here: simulation of logistic regression power analysis designed experiments. – gung May 26 '13 at 16:42
• I didn't think simulations would be a fruitful approach when proportions are very small (on the order of 1 in 50,000 or less). – russellpierce May 26 '13 at 17:34
• I'm also not clear on how hypothetical instances where a marginal proportion is 0 should be treated. – russellpierce May 26 '13 at 17:39
• @RusselS.Pierce, you're right, simulations become more unwieldy the closer the proportions get to the boundaries. That's because power (viz, whether an iteration is 'significant') is a Bernoulli. – gung May 26 '13 at 17:44
• This is relevant: stats.stackexchange.com/questions/235750/… how small do you imagine $p$ can be? – kjetil b halvorsen Apr 14 '17 at 12:31