[R] power.anova.test for interaction effects
Andrew Kniss
akniss at uwyo.edu
Thu Feb 24 19:34:54 CET 2005
Using the data set posted at
http://uwstudentweb.uwyo.edu/A/AKNISS/sbxherb.txt
I obtained this output from R:
> data(sbxherb)
> attach(sbxherb)
> sbxherb$rep<-factor(c("I","II","III"))
> sbxherb$var<-factor(sbxherb$var)
> sbxherb$trt<-factor(sbxherb$trt, labels=c("Check","Early","Late","Micro"))
> detach(sbxherb)
> attach(sbxherb)
> aov.sbx<-aov(yield~rep + trt * var + Error(rep/(trt+var)))
> summary(aov.sbx)
Error: rep
Df Sum Sq Mean Sq
rep 2 122.158 61.079
Error: rep:trt
Df Sum Sq Mean Sq F value Pr(>F)
trt 3 201.131 67.044 1.3096 0.355
Residuals 6 307.160 51.193
Error: rep:var
Df Sum Sq Mean Sq F value Pr(>F)
var 36 4613.9 128.2 8.4392 1.425e-14 ***
Residuals 72 1093.5 15.2
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
Error: Within
Df Sum Sq Mean Sq F value Pr(>F)
trt:var 108 956.62 8.86 0.9731 0.5574
Residuals 216 1966.04 9.10
I would like to use this output to help design next years study, which will
be carried out with the same design. However, I would like to know what the
sample size should be in order to have an 80% chance of finding a 10%
difference in the interaction term trt:var at alpha=0.05. Is there a way to
coerce power.anova.test() to make this calculation for me? I have tried
using this function to give me the sample size needed to find differences
given the within and between groups variance from the previous study, but
with no success. If I have it calculate the power from this data set, it
tells me I have a power of 1, which I doubt is true given the high p-value
and wide confidence intervals around the estimates.
> power.anova.test(groups=148,
+ sig.level=0.05,
+ power=0.8,
+ within.var=9.10,
+ between.var=8.86)
Error in uniroot(function(n) eval(p.body) - power, c(2, 1e+05)) :
f() values at end points not of opposite sign
> power.anova.test(groups=148,
+ sig.level=0.05,
+ n=3,
+ within.var=9.10,
+ between.var=8.86)
Balanced one-way analysis of variance power calculation
groups = 148
n = 3
between.var = 8.86
within.var = 9.1
sig.level = 0.05
power = 1
NOTE: n is number in each group
Any help is greatly appreciated. I apologize if I seem to be nagging on
this issue, but I thought this post was much better at describing what I am
after. Thanks in advance.
Andrew Kniss
University of Wyoming
akniss at uwyo.edu
-----Original Message-----
From: Andrew Criswell [mailto:andrew at arcriswell.com]
Sent: Tuesday, February 22, 2005 9:30 PM
To: akniss at uwyo.edu
Subject: Re: [R] power.anova.test for interaction effects
Dear Andrew,
If you could supply us with your data, more help would possibly be
forthcoming.
Best wishes,
Andrew
Andrew Criswell, PhD
Graduate School, Bangkok University
More information about the R-help
mailing list