Means: Many Groups (ANOVA)
Calculate the balanced sample size required to detect the main effects of both factors in a two-way fixed-effects ANOVA. The calculator uses the noncentral F distribution and reports the required sample size for each main effect, along with the larger requirement needed to achieve the requested power for both effects.
This calculator follows the fixed-effects two-way ANOVA power and sample-size framework documented for Stata's power twoway procedure. Two factors are specified, and the main effects are tested separately with F tests. Under the alternative hypothesis, each F statistic follows a noncentral F distribution.
For a balanced design, the anticipated cell means are used to calculate the variance explained by each main effect. For Factor A, the marginal mean for each A level is compared with the grand mean. For Factor B, the corresponding B-level marginal means are compared with the grand mean.
For a balanced design with n subjects per cell and J × K cells, the total sample size is N = nJK. The denominator degrees of freedom are N − JK. The numerator degrees of freedom are J − 1 for Factor A and K − 1 for Factor B. The noncentrality parameter is
The critical value is the upper α quantile of the corresponding central F distribution. Power is the probability, under the noncentral F distribution, that the test statistic exceeds that critical value. The calculator searches sequentially over integer subjects per cell until the requested power is reached.
The two main effects are evaluated independently. The Factor A result answers whether the planned study has sufficient power to detect the specified differences among the marginal means of Factor A. The Factor B result does the same for the marginal means of Factor B.
If both main effects are of interest, the displayed combined requirement is the larger of the two required total sample sizes. This preserves the requested power for each main-effect test under the same balanced design.
Cell means:
Factor A level 1: 134, 143, 91
Factor A level 2: 106, 173, 145
Residual variance: 1417
α: 0.05
Target power: 0.80
These values reproduce the worked examples in the Stata power twoway documentation, based on the NO2 exposure experiment described by van Belle et al. The published calculation gives a required total sample size of 132, or 22 subjects per cell, for the row/main effect. For the column/main effect it gives 48 total subjects, or 8 subjects per cell.
The calculator independently reproduces those integer balanced-design requirements: Factor A = 132 total (22/cell), Factor B = 48 total (8/cell), with a combined requirement of 132 total subjects when both main effects must meet 80% power.
StataCorp. (2025). power twoway — Power analysis for two-way analysis of variance. Stata Power and Sample-Size Reference Manual. The documentation defines the two-way fixed-effects ANOVA hypotheses, noncentral F power calculation, effect-size definition, balanced-design assumptions, and worked sample-size examples.
van Belle, G., Fisher, L. D., Heagerty, P. J., & Lumley, T. (2004). Biostatistics: A Methodology for the Health Sciences, 2nd ed. Wiley. The Stata documentation uses the NO2 protein-leakage example from this text as its worked two-way ANOVA example.