[R] anova error
Jean.Coursol at math.u-psud.fr
Jean.Coursol at math.u-psud.fr
Wed Dec 1 14:44:59 CET 2010
Just for fun
This small program gives negative Sum of Sq in anova (with R versions
2.9.2 and 2.10.0) (linux 32 kernel 2.6.29.6-smp slackware 13.0) :
y = c(3.6, 5.0, 5.0, 4.6, 4.5, 4.3, 4.5, 5.1, 4.5, 4.3)
trans = as.factor(c("NT","NT","NT","NT","NT","T","T","T","T","T"))
lc = lm(y ~ trans)
l1 = lm(y ~ 1)
anova(l1,lc)
# Analysis of Variance Table
#
# Model 1: y ~ 1
# Model 2: y ~ trans
# Res.Df RSS Df Sum of Sq F Pr(>F)
# 1 9 1.744
# 2 8 1.744 1 -2.220e-16 # negative Sum of Sq ????
anova(lc) # is OK
# 2.9.2 version
# Analysis of Variance Table
#
# Response: y
# Df Sum Sq Mean Sq F value Pr(>F)
# trans 1 8.214e-32 8.214e-32 3.768e-31 1
# Residuals 8 1.744 0.218
# 2.10.0 version
# Analysis of Variance Table
#
# Response: y
# Df Sum Sq Mean Sq F value Pr(>F)
# trans 1 0.000 0.000 0 1
# Residuals 8 1.744 0.218
More information about the R-help
mailing list