Notation:
Outcome 

Failure 
Success 

Group 
1 



2 





m 
N 
The hypotheses are
where is constrained to be 0 for the likelihood ratio and Fisher’s exact tests. If in an upper onesided test or in a lower onesided test, then the test is a noninferiority test. If in an upper onesided test or in a lower onesided test, then the test is a superiority test. Although is unconstrained for the Pearson chisquare test, is not recommended for that test. The FarringtonManning score test is a better choice when .
Internal calculations are performed in terms of , , and . An input set consisting of OR, , and is transformed as follows:
An input set consisting of RR, , and is transformed as follows:
Note that the transformation of either or to is not unique. The chosen parameterization fixes the null value at the input value of . Some values of or might lead to invalid values of ( or ), in which case an "Invalid input" error occurs.
The FarringtonManning score test is based on equations (1), (2), and (12) in Farrington and Manning (1990). The test statistic, which is assumed to have a null distribution of under , is
where and are the maximum likelihood estimates of the proportions under the restriction .
Sample size for the onesided cases is given by equations (4) and (12) in Farrington and Manning (1990). Onesided power is computed by inverting the sample size formula. Power for the twosided case is computed by adding the lowersided and uppersided powers, each evaluated at . Sample size for the twosided case is obtained by numerically inverting the power formula,
where
For the onesided cases, a closedform inversion of the power equation yields an approximate total sample size of
For the twosided case, the solution for N is obtained by numerically inverting the power equation.
The usual Pearson chisquare test is unconditional. The test statistic
is assumed to have a null distribution of .
Sample size for the onesided cases is given by equation (4) in Fleiss, Tytun, and Ury (1980). Onesided power is computed as suggested by Diegert and Diegert (1981) by inverting the sample size formula. Power for the twosided case is computed by adding the lowersided and uppersided powers each evaluated at . Sample size for the twosided case is obtained by numerically inverting the power formula. A custom null value for the proportion difference is also supported, but it is not recommended. If you are using a nondefault null value, then the FarringtonManning score test is a better choice.
For the onesided cases, a closedform inversion of the power equation yields an approximate total sample size
For the twosided case, the solution for N is obtained by numerically inverting the power equation.
The usual likelihood ratio chisquare test is unconditional. The test statistic
is assumed to have a null distribution of and an alternative distribution of , where
The approximate power is
For the onesided cases, a closedform inversion of the power equation yield an approximate total sample size
For the twosided case, the solution for N is obtained by numerically inverting the power equation.
Fisher’s exact test is conditional on the observed total number of successes m. Power and sample size computations are based on a test with similar power properties, the continuityadjusted arcsine test. The test statistic
is assumed to have a null distribution of and an alternative distribution of , where
The approximate power for the onesided balanced case is given by Walters (1979) and is easily extended to the unbalanced and twosided cases:
The approximation is valid only for .