[R] define F-ratio computations with aov
Michael Rennie
mdrennie at gmail.com
Wed Mar 17 13:32:18 CET 2010
Howdy,
In the past, I've just run the ANOVA as normal, and then just grabbed
the appropriate MS for the estimation of F ratios. Eg, this will get you
the MS in your anova object:
summary(obj.aov)[[1]][3]
or
summary(obj.aov)$Mean
And if you want a specific MS,
summary(obj.aov)[[1]][[1,3]]
or
summary(obj.aov)[[1]]$Mean[1]
Then you can just put whichever MS over whichever other MS, estimate
your F-ratios, with something like:
Ffact<- summary(obj.aov)[[1]]$Mean[1]/summary(obj.aov)[[1]]$Mean[3]
estimate the p-values with:
pFfact<-1-pf(Ffact, summary(obj.aov)[[1]]$Df[1],
summary(obj.aov)[[1]]$Df[3])
and you're off to the races.
You can also specify error strata in the aov() model, but then all you
get is the MS and you have to estimate your F-ratios anyway (though the
indexing is a little different). E.g., if you had a nested anova, you
could specify it as:
ex.aov<-aov(Fixed ~ Nested + Error(Nested/Fixed))
At least this way, the summary() doesn't give you the wrong F-ratios, so
you aren't temped to interpret them incorrectly (as you would in the
previous example).
HTH,
Mike
Galanidis Alexandros wrote:
> Greetings to all,
>
> This is my model: aov.fit<-aov(Y~A+B+C+D+E+A:C+A:E)
>
> In summary(aov.fit) all F values are comptuted by eg MS(A)/MS(Residuals). This is not correct (or what I want), except for F(B) and F(A:E). I suppose P values are not correct either.
>
> Is it possible with aov to define the way F computations will be done? I 'd like them to be like this: F(A)=MS(A)/MS(E), F(C)=MS(C)/MS(E), F(D)=MS(D)/MS(E), F(E)=MS(E)/MS(A:E), F(A:C)=MS(A:C)/MS(A:E)
>
> thanks
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
More information about the R-help
mailing list