# [R] How does R compute sums of squares?

Douglas Bates bates at stat.wisc.edu
Mon Dec 13 17:29:18 CET 2010

```On Mon, Dec 13, 2010 at 8:20 AM, Ethan Arenson
<ethan.a.arenson at gmail.com> wrote:
> Consider the following missing data problem:
>
>  y = c(1, 2, 2, 2, 3)
> a = factor(c(1, 1, 1, 2, 2))
> b = factor(c(1, 2, 3, 1, 2))
> fit = lm(y ~ a + b)
> anova(fit)
>
>  Analysis of Variance Table
>
> Response: y
>          Df  Sum Sq Mean Sq    F value    Pr(>F)
> a          1 0.83333 0.83333 1.3637e+33 < 2.2e-16 ***
> b          2 1.16667 0.58333 9.5461e+32 < 2.2e-16 ***
> Residuals  1 0.00000 0.00000
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> Warning message:
> In anova.lm(fit) :
>  ANOVA F-tests on an essentially perfect fit are unreliable
>
> I am trying to understand how R computes sums of squares. I know that R
> makes a FORTRAN call to dqrls to make a QR decomposition of the design
> matrix, which returns (among other things),

>  fit\$effects
>  (Intercept)            a2            b2            b3
> -4.472136e+00  9.128709e-01  7.715167e-01  7.559289e-01  2.471981e-17
>
> Can anyone elaborate on how R computes these effects? I am not satisfied
> with the explanation that R provides with the help(effects) command.

Q'y

>
> Ethan
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help