# [R] Bug in power.anova.test?

Peter Levy plevy at ceh.ac.uk
Mon Nov 8 18:47:31 CET 2004

```I think there is a bug in power.anova.test.  Firstly, n, the number of
samples needed in each group, decreases as the number of groups
increases.  Should the reverse not be the case?
Secondly:

>      power.anova.test(groups = 2, between.var=424.36, within.var=256,
sig.level= 0.1, power=.90)

gives the answer n = 5.986304 where n is number of samples needed in
each group.

Four other sources give the answer n=12 (11.08 rounded up):

1. One-way ANOVA with 2 groups should be the same as a t-test.
Power.t.test gives.
>  power.t.test(n=NULL, delta=20.6, sd=16.0, sig.level=0.1, power=0.9,
type=c("two.sample"), alternative=c("two.sided"), strict=FALSE)

2. p35, example 2 in Steidl, R.J. and Thomas, L.  (2001)  Power
analysis and experimental design.  In: Design and Analysis of Ecological
Experiments, (eds S. M. Scheiner and J. Gurevitch), pp. 415. Open
University Press, New York.
http://www.oup-usa.org/sc/0195131878/c2_ex2a.html

3. Minitab gives
Power and Sample Size
One-way ANOVA
Alpha = 0.1  Assumed standard deviation = 16  Number of Levels = 2
Sample  Target                   Maximum
SS Means    Size   Power  Actual Power  Difference
212.18      12     0.9      0.920676        20.6
The sample size is for each level.

4. Minitab gives
Power and Sample Size
2-Sample t Test
Testing mean 1 = mean 2 (versus not =)
Calculating power for mean 1 = mean 2 + difference
Alpha = 0.1  Assumed standard deviation = 16
Sample  Target
Difference    Size   Power  Actual Power
20.6      12     0.9      0.920676
The sample size is for each group.

Peter Levy
Centre for Ecology and Hydrology
Bush Estate, Penicuik
Midlothian, EH26 0QB, UK
Tel: 0131 445 8556 (direct)
0131 445 4343 (switchboard)
Fax: 0131 445 3943
E-mail: plevy at ceh.ac.uk

```