[R] Why does lmList() fail when lm() doesn't?
Michael Kubovy
kubovy at virginia.edu
Mon Apr 2 15:11:07 CEST 2007
Dear r-helpers,
Can anyone suggest why lm() doesn't complain here:
summary(osss.lm1 <- lm(logOdds ~ c.setSize %in% task, data = osss))
whereas in package:nlme (and in package:lme4)
osss.lmL <- lmList(logOdds ~ c.setSize %in% task | subj, data = osss)
# Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
# contrasts can be applied only to factors with 2 or more levels
If it were because for each subj I have only 1 datum per cell:
with(subset(osss, osss$subj == '42'), table(setSize, task))
# task
# setSize os ss
# 2 1 1
# 3 1 1
# 4 1 1
# 5 1 1
# 6 1 0
# 7 1 0
then
osss.lm1 <- lm(logOdds ~ c.setSize %in% task, data = subset(osss, osss
$subj == '42'))
should fail as well, but I get
anova(osss.lm1)
# Analysis of Variance Table
#
# Response: logOdds
# Df Sum Sq Mean Sq F value Pr(>F)
# c.setSize:task 2 6.8269 3.4134 1.9976 0.2059
# Residuals 7 11.9612 1.7087
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA 22904-4400
Parcels: Room 102 Gilmer Hall
McCormick Road Charlottesville, VA 22903
Office: B011 +1-434-982-4729
Lab: B019 +1-434-982-4751
Fax: +1-434-982-4766
WWW: http://www.people.virginia.edu/~mk9y/
More information about the R-help
mailing list