Hello all:
I am confused about the output from a lm() model with an incomplete
design/missing level.
I have two categorical predictors and a continuous covariate (day) that
I am using to model larval mass (l.mass):
leaf.species has three levels - map, syc, and oak
cond.time has two levels - 30 and 150.
There are no response values for Map-150, so that entire, two-way, level
is missing.
When running anova() on the model with Type I SS, the full factorial
design does not return errors; however, using package:car Anova() and
Type III SS, I receive an singularity error unless I used the argument
'singular.ok = T' (it is defaulted to F).
So, why don't I receive an error with anova() when I do with Anova(type
= "III")? How do anova() and Anova() handle incomplete designs, and how
can interactions of variables with missing levels be interpreted?
I realize these are fairly broad questions, but any insight would be
helpful. Thanks, all.
Below is code to illustrate my question(s):
> lmMass <- lm(log(l.mass) ~ day*leaf.species + cond.time, data =
growth.data) #lm() without cond.time interactions
> lmMassInt <- lm(log(l.mass) ~ day*leaf.species*cond.time, data =
growth.data) #lm() with cond.time interactions
> anova(lmMass); anova(lmMassInt) #ANOVA summary of both models
with Type I SS
Analysis of Variance Table
Response: log(l.mass)
Df Sum Sq Mean Sq F value Pr(>F)
day 1 51.373 51.373 75.7451 2.073e-15
leaf.species 2 0.340 0.170 0.2506 0.7786
cond.time 1 0.161 0.161 0.2369 0.6271
day:leaf.species 2 1.296 0.648 0.9551 0.3867
Residuals 179 121.404 0.678
Analysis of Variance Table
Response: log(l.mass)
Df Sum Sq Mean Sq F value Pr(>F)
day 1 51.373 51.373 76.5651 1.693e-15
leaf.species 2 0.340 0.170 0.2533 0.77654
cond.time 1 0.161 0.161 0.2394 0.62523
day:leaf.species 2 1.296 0.648 0.9655 0.38281
day:cond.time 1 0.080 0.080 0.1198 0.72965
leaf.species:cond.time 1 1.318 1.318 1.9642 0.16282
day:leaf.species:cond.time 1 1.915 1.915 2.8539 0.09293
Residuals 176 118.091 0.671
> Anova(lmMass, type = 'III'); Anova(lmMassInt, type = 'III')
#ANOVA summary of both models with Type III SS
Anova Table (Type III tests)
Response: log(l.mass)
Sum Sq Df F value Pr(>F)
(Intercept) 39.789 1 58.6653 1.13e-12
day 3.278 1 4.8336 0.02919
leaf.species 0.934 2 0.6888 0.50352
cond.time 0.168 1 0.2472 0.61968
day:leaf.species 1.296 2 0.9551 0.38672
Residuals 121.404 179
Error in Anova.III.lm(mod, error, singular.ok = singular.ok, ...) :
there are aliased coefficients in the model
> Anova(lmMassInt, type = 'III', singular.ok = T) #Given the error
in Anova() above, set singular.ok = T
Anova Table (Type III tests)
Response: log(l.mass)
Sum Sq Df F value Pr(>F)
(Intercept) 39.789 1 59.3004 9.402e-13
day 3.278 1 4.8860 0.02837
leaf.species 1.356 2 1.0103 0.36623
cond.time 0.124 1 0.1843 0.66822
day:leaf.species 2.783 2 2.0738 0.12877
day:cond.time 0.805 1 1.1994 0.27493
leaf.species:cond.time 0.568 1 0.8462 0.35888
day:leaf.species:cond.time 1.915 1 2.8539 0.09293
Residuals 118.091 176
>
-
Justin Montemarano
Graduate Student
Kent State University - Biological Sciences
http://www.montegraphia.com
<http://www.montegraphia.com/>
--
Justin Montemarano
Graduate Student
Kent State University - Biological Sciences
http://www.montegraphia.com
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.