# How do I do an a priori power analysis for a 2x3 factorial anova?

Apologies if this is confused, I'm utterly lost with this. I want to do a questionnaire based experiment with 6 conditions (1 factor with 2 levels and another with 3 levels) and different participants in each condition. I need to do an a priori power analysis to work out the required sample size. I'm struggling to work out the effect sizes from previous research, but lets assume it's 'medium'. I've got g*power 3.1. How do I go about conducting the power analysis? I don't even know which statistical test to select! Any help would be hugely appreciated.

• What you've shared so far is really helpful. Thanks - I have a further question... When you say N=59 do you mean: 1) sample size per group ; or 2) total sample size (i.e. 59 / 6 = 10 per group) – Noobiegraduate Feb 18 '17 at 6:52

I'm afraid I don't know how to use g*power specifically, but I can give you an example of how to do this sort of calculation using the R package pwr, which has a lot of the same capabilities as g*power. The function I'll be using is pwr.f2.test, which does power calculations for tests in the General Linear Model framework (ANOVA models included).

In general in the GLM, the following four quantities are dependent on each other:

1. The number of observations (i.e., degrees of freedom)
2. The size of the effect in the population
3. Alpha (the desired rate of Type 1 errors if the null hypothesis were true)
4. Power

That means, of course, that if you have three of these quantities, you can mathematically derive the fourth. pwr.f2.test accepts as arguments three of these four quantities and gives you the value of the fourth. The effect size metric that pwr.f2.test works with is $f^2$, which is defined as

$$\text{effect of interest }\Delta R^2 / (1 - \text{model } R^2)$$

So, if you plan to include covariates in your model, the calculation of $f^2$ accounts for these covariates through the fact that your model $R^2$ will be larger than the $\Delta R^2$ of the effect of interest, resulting in a larger value for $f^2$.

Let's say, though, that you don't have any precise estimates how large your effect will be, other than that you think it might be of a "medium" size. You can access Cohen's guidelines for effect sizes through the cohen.ES function:

f2 <- cohen.ES("f2", size = "medium")\$effect.size # .15


Assuming that your effect of interest is a 1 degree of freedom contrast, you can then fill in the remaining parameters for pwr.f2.test like so:

pwr.f2.test(u = 1, # I'm assuming you plan to test a 1 df effect
f2 = f2, # We're using Cohen's effect size guidelines, shown above
sig.level = .05, # Our alpha
power = .80) # Our desired power


pwr.f2.test will tell us a value for v, which are the denomenator degrees of freedom in a GLM (or, if you prefer, an ANOVA). In this case, the value of v is about 52.31. In your case, because you have a full crossed 2 by 3 design, that means that the N required to obtain 80% power is $$52.31 + 1 \text{ (intercept)} + 5 \text{ (five parameters required to represent a 2 by 3 fully crossed design)} = 59$$