[R] anova error

Peter Ehlers ehlers at ucalgary.ca
Wed Dec 1 15:18:25 CET 2010


It might be a good idea not to use an outdated version of R.
I don't see your "problem" in R 2.12.0.

Peter Ehlers

On 2010-12-01 05:44, Jean.Coursol at math.u-psud.fr wrote:
> 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
>
> ______________________________________________
> 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