This calculator is useful for tests comparing paired proportions. Suppose that our sample consists of pairs of subjects, and that each pair contains a subject from group 'A' and a subject from group 'B'. Further suppose that we wish to compare the probability that an event occurs in group 'A' to that in group 'B'. Example study designs include matched case-control studies and cross-over studies. Conceptually, the data can be listed as in the following table.
Group 'B' | |||
Success | Failure | ||
Group 'A' | Success | $n_{11}$ | $n_{10}$ |
Failure | $n_{01}$ | $n_{00}$ |
Here, $n_{ij}$ represents the number of pairs having $i$ successes in Group 'A' and $j$ successes in Group 'B'. The corresponding proportions are denoted $p_{ij}$, with table
Group 'B' | |||
Success | Failure | ||
Group 'A' | Success | $p_{11}$ | $p_{10}$ |
Failure | $p_{01}$ | $p_{00}$ |
Interest is in comparing the following hypotheses:
This calculator uses the following formulas to compute sample size and power, respectively:
$$
n=\left(\frac{z_{1-\alpha}\sqrt{p_{disc}}+z_{1-\beta}\sqrt{p_{disc}-p_{diff}^2}}{p_{diff}}\right)^2$$
$$1-\beta=\Phi\left(\frac{|p_{diff}|\sqrt{n}-z_{1-\alpha}\sqrt{p_{disc}}}{\sqrt{p_{disc}-p_{diff}^2}}\right)$$
where
R code to implement these functions:
p01=0.45 p10=0.05 alpha=0.05 beta=0.10 pdisc=p10+p01 pdiff=p10-p01 (n=((qnorm(1-alpha)*sqrt(pdisc)+qnorm(1-beta)*sqrt(pdisc-pdiff^2))/pdiff)^2) ceiling(n) # 23 x=(abs(pdiff)*sqrt(n)-qnorm(1-alpha)*sqrt(pdisc))/sqrt(pdisc-pdiff^2); (Power = pnorm(x))
Connor R. J. 1987. Sample size for testing differences in proportions for the paired-sample design. Biometrics 43(1):207-211. page 209.