[R] type III ANOVA for a nested linear model
Bill.Venables at csiro.au
Bill.Venables at csiro.au
Tue Jul 10 14:44:16 CEST 2007
The message from this cute little data set is very clear. Consider
> fm <- aov(resp ~ A*B + A/C, mydata)
>
> drop1(fm, test = "F")
Single term deletions
Model:
resp ~ A * B + A/C
Df Sum of Sq RSS AIC F value Pr(F)
<none> 65.540 47.261
A:B 2 16.132 81.672 47.222 0.7384 0.5168
A:C 6 199.501 265.041 60.411 3.0440 0.1007
So neither of the non-marginal terms is significant. To address
questions about the main effects the natural next step is to remove the
interactions. By orthogonality you can safely cut a few corners and do
both at once:
> drop1(update(fm, .~A+B), test = "F")
Single term deletions
Model:
resp ~ A + B
Df Sum of Sq RSS AIC F value Pr(F)
<none> 281.17 57.47
A 2 33.12 314.30 55.48 0.8246 0.4586
B 1 915.21 1196.38 81.54 45.5695 9.311e-06
There is a very obvious, even trivial, B main effect, but nothing else.
All this becomes even more glaring if you take the unusal step of
plotting the data.
What sort of editor would overlook this clear and demonstrable message
leaping out from the data in favour of some arcane argument about "types
of sums of squares"? Several answers come to mind: A power freak, a SAS
afficianado, an idiot.
If you get nowhere with this editor, my suggestion, hard as it may seem,
is that you do not submit to that kind of midnless idealogy and make
fatuous compromises for the sake of immediate publication. If necessary,
part company with that editor and find somewhere else to publish where
the editor has some inkling of what statistical inference is all about.
Bill Venables.
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Carsten Jaeger
Sent: Tuesday, 10 July 2007 4:15 AM
To: R help list
Subject: [R] type III ANOVA for a nested linear model
Hello,
is it possible to obtain type III sums of squares for a nested model as
in the following:
lmod <- lm(resp ~ A * B + (C %in% A), mydata))
I have tried
library(car)
Anova(lmod, type="III")
but this gives me an error (and I also understand from the documentation
of Anova as well as from a previous request
(http://finzi.psych.upenn.edu/R/Rhelp02a/archive/64477.html) that it is
not possible to specify nested models with car's Anova).
anova(lmod) works, of course.
My data (given below) is balanced so I expect the results to be similar
for both type I and type III sums of squares. But are they *exactly* the
same? The editor of the journal which I'm sending my manuscript to
requests what he calls "conventional" type III tests and I'm not sure if
can convince him to accept my type I analysis.
R> mydata
A B C resp
1 1 1 1 34.12
2 1 1 2 32.45
3 1 1 3 44.55
4 1 2 1 20.88
5 1 2 2 22.32
6 1 2 3 27.71
7 2 1 6 38.20
8 2 1 7 31.62
9 2 1 8 38.71
10 2 2 6 18.93
11 2 2 7 20.57
12 2 2 8 31.55
13 3 1 9 40.81
14 3 1 10 42.23
15 3 1 11 41.26
16 3 2 9 28.41
17 3 2 10 24.07
18 3 2 11 21.16
Thanks a lot,
Carsten
______________________________________________
R-help at stat.math.ethz.ch 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