I on a recent homework assignment I missed a question because R seemingly miscomputed the power of the ANOVA. I want to figure out why.
In the R code the equation for the non-centrality parameter for F is:
This gave an answer of 60 when it should have been 45 and the question is "why?"
The more traditional expression of λ is:
From the PSY304B class notes, it is possible to show that the ratio of has a noncentrality parameter of:
Consider this for equal group sizes (nj = n ∀ j) in terms of the between group variance, . Bear in mind that, for some reason I can't fully recall, the divisor for the variance of the means is n and not n - 1.
There's the problem. The R code used J - 1 as the divisor for .
Given that I don't actually know why it should be J rather than J - 1, one of the simplest methods for me to prove one way or the other is using simulation. Simply run 10,000 or 100,000 ANOVAs on data randomly generated to fit the desired characteristics.
This is actually somewhat tricky. The desired characteristics are:
One question is how random should the data be? I can generate J means from a normal distribution with a variance of and then for each generate n samples from a distribution .
Another option is to fix the s. Consider a set of samples: