# Logistic regression: Sample size for emmeans comparisons

I conducted a logistic regression with a 3-levels categorical predictor in SPSS using the GENLIN procedure. As I am interested in the pairwise comparisons between all three predictor levels, I used the /EMMEANS subcommand, SCALE=transformed, and obtained log OR which I could then transform into OR.

However, I am wondering how to to a proper a-priori sample size planning/power analysis. Let's say the minimum effect size between two levels that I am interested in is OR = 2.5 - how can I derive the required sample size in the next step?

Any input is highly appreciated.

## 1 Answer

Think about equal sample sizes $$n$$, and suppose that two proportions being compared, $$p_1$$ and $$p_2$$, are near $$0.5$$. I determined by trial and error that the odds ratio is about 2.5 when $$p_j = \frac12 \pm 0.112$$. The $$z$$ statistic for comparing these is $$z \approx \frac{\hat p_1- \hat p_2}{\sqrt{2\times(\frac12\cdot\frac12)/n}} = \sqrt{2n}(\hat p_1 - \hat p_2)$$ Now, if we want a power of $$\beta$$ when the comparison is tested at a significance level of $$\alpha$$, we need to set a target value of $$z$$ at $$\sqrt{2n}\times(2\times0.112) = 0.318\sqrt n$$, and equate that with $$(z_{\alpha/2}+z_\beta)$$. But in this case, let's throw in a Bonferroni correction and really use $$\alpha/3$$, because we'll be doing 3 such comparisons. Thus, for significance 0.05 and power 0.8, we have $$n \ge \left(\frac{z_{0.025/3} + z_{0.2}}{0.318}\right)^2 = \left(\frac{2.394 + 0.842}{0.318}\right)^2 \approx 104$$ You'll need 104 observations at each level of the categorical predictor. You may get by with less if in fact the $$p_j$$ are not near $$\frac12$$, which is the worst-case scenario.

PS -- I confirmed this result using the Java app available at https://homepage.divms.uiowa.edu/~rlenth/Power/index.html (The "test comparing two proportions" dialog, with p1 = .388 and p2 = .612). If you incorporate the continuity correction, however, the required sample size becomes $$n=112$$.