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:

λ = nJ-1 σμ2 σy2

This gave an answer of 60 when it should have been 45 and the question is "why?"

The more traditional expression of λ is:

λ = μiσi2

From the PSY304B class notes, it is possible to show that the ratio of MSBMSW has a noncentrality parameter of:

λ = j=1J nj μj-μ_ 2 σy2

Consider this for equal group sizes (nj = nj) in terms of the between group variance, σμ2 . 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.

σμ2 = j=1J μj-μ_ 2 J j=1J μj-μ_ 2 = Jσμ2 λ = j=1J n μj-μ_ 2 σy2 = n j=1J μj-μ_ 2 σy2 = nJσμ2 σy2 = nJ σμ2 σy2

There's the problem. The R code used J - 1 as the divisor for σμ2 .

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 σμ2 and then for each μi generate n samples from a distribution N μ=μi σy2 .

Another option is to fix the μi s. Consider a set of samples:

X = μ+α μμμμ μ-α X_ = xin = μ+α+ μ++μ+ μ-α n = nμn = μ α σx2 = xi-μ2 n = μ+α-μ 2 + μ-μ2 ++ μ-μ2 + μ-α-μ 2 n = 2α2 n α = nσx22