[R] Bug in power.anova.test?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Mon Nov 8 19:22:50 CET 2004
Two groups with a difference in mean of 20.6 have a between-group variance
of 212.18 (as Minitab was given), not 424.36.
> var(c(0, 20.6))
[1] 212.18
(and the example on the help page shows this *is* what is meant by the
variance).
On Mon, 8 Nov 2004, Peter Levy wrote:
> 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?
No. Think about having four groups, 2 with one mean and 2 with the
another mean. This is effectively a 2-group problem with twice the sample
size.
> 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.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list