# [BioC] silly lm and anova question

Pedro López Romero plopez at cnic.es
Tue Dec 12 11:55:36 CET 2006

```Hi James,

There is nothing weird at all in your lm() results. You must be aware that
the anova table that you are obtaining is a sequential analysis of variance,
so  when you fit:

g1 = lm(z ~ x+y)

the sum of squares of x measures the contribution of *x*, after fitting a
overall mean (intercept), and the ss of *y*, gives the contribution of *y*
after fitting the overall mean and the *x*.

These ss are known as type I or sequential sum of squares.-
This sequential SS tells you how much the residual sum of squares is reduced
by adding a parameter to a model that already contains other factors. So, if
you change the order of parameters in your formula, you will obtain
different ss.

HTH.-

Pedro.-

-----Mensaje original-----
De: bioconductor-bounces at stat.math.ethz.ch
[mailto:bioconductor-bounces at stat.math.ethz.ch] En nombre de Wolfgang Huber
Enviado el: martes, 12 de diciembre de 2006 10:18
Para: James Anderson
CC: bioconductor
Asunto: Re: [BioC] silly lm and anova question

Dear James,

You will need to send a code example that other people can copy/paste,
rerun and reproduce. Otherwise you may have very little chance of

Best wishes

Wolfgang Huber

------------------------------------------------------------------
Wolfgang Huber  EBI/EMBL  Cambridge UK  http://www.ebi.ac.uk/huber

James Anderson wrote:
> Hi,
>   I am using linear model lm and anova. However, I found the following
weird phenomenon:
>
> g1 = lm(z ~ x+y)
> g2 = lm(z ~ y+x)
>
> g1 and g2 have the same linear regression results. However,
> anova(g1) and anova(g2) gives very different results in the calculation
for sum of square in x and y. the residuals are the same. It looks like a
simple question, but I have not figured it out why.
>
>   Many thanks,
>   James
>

_______________________________________________
Bioconductor mailing list
Bioconductor at stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives:
http://news.gmane.org/gmane.science.biology.informatics.conductor

```