Skip to content

power of 2 way ANOVA with interaction

3 messages · Timothy Spier, Peter Dalgaard, Greg Snow

#
On Apr 4, 2011, at 01:10 , Timothy Spier wrote:

            
They're not massively hard to do by hand, if you know what you're doing (which, admittedly is a bit hard to be sure of in this case). The basic structure can be lifted from power.anova.test and the name of the game is to work out the noncentrality parameter of the  relevant F tests. E.g., lifting an example from the SAS manual:
1  2  3
1 14 16 21
2 10 15 16

Now, you have 10 replicates of this with a specified SD of 5. If we do a "skeleton analysis" of the above table, we get
Analysis of Variance Table

Response: x
          Df Sum Sq Mean Sq F value Pr(>F)
ex         1 16.667 16.6667               
var        2 42.333 21.1667               
ex:var     2  4.333  2.1667               
Residuals  0  0.000                       
Warning message:
In anova.lm(lm(x ~ ex * var, twoway)) :
  ANOVA F-tests on an essentially perfect fit are unreliable

In a 10-fold replication, the SS would be 10 times bigger, and the residual Df would be 54; also, we need to take the error variance of 5^2 = 25 into account. The noncentrality for the interaction term is thus 43.333/25 and you can work out the power as
[1] 0.1914457

Similarly, the main effect powers are
[1] 0.956741
[1] 0.7176535

(whatever that means in the presence of interaction, but that is a different discussion)
#
You can use simulation:

1. decide what you think your data will look like
2. decide how you plan to analyze your data
3. write a function that simulates a dataset (common arguments include sample size(s) and effect sizes) then analyzes the data in your planned manner and returns the p-value(s) or other statistic(s) of interest
4. run the function from 3 a bunch (1000 or more) times, the replicate function is useful for this (progress bars can also be useful)
5. the proportion of times that the results are significant is your estimate of power