Solved – Estimate sample size for chi-squared test

chi-squared-testsample-size

I want to perform a chi-square test for a 2×2 table. Given that I might expect p-value < 0.05, how can I estimate the required sample size?

Best Answer

In order to estimate your sample, you need to know

  • which statistical significance (type I error) you want to reach
  • what statistical power (1 - type II error) you want to reach
  • which minimal detectable difference you want to see in your data

One of the most used methods to estimate your sample size is given in the book "Statistical Methods for Rates and Proportions" of Fleiss (1973). See page 72, equation 4.15 for the corrected formula.

Here is the equation:

enter image description here

  • $n'$ is sample size without continuity correction
  • $n$ is sample size with the correction
  • $P_1$, $P_2$, are proportions in each group
  • $Q_1 = 1 - P_1$
  • $\bar P = \frac{P_1 + P_2}{2}$
  • $z_{\alpha/2}$ is value cutting off the proportion $\alpha / 2$ in the upper tail of the standard normal curve. (same for $z_\beta$)

You can find an implementation of it in R: power.prop.test in the stats package.