[R] abline and linearity over groups

From: Jabez Wilson <jabezwuk_at_yahoo.co.uk>
Date: Thu 04 Aug 2005 - 00:23:57 EST

Dear R users, please can you help me understand the behaviour of abline using function lm.

I'm trying to learn linearity over groups. So I make three groups with 10 values each:

l=c(rnorm(10,0,30),rnorm(10,100,30),rnorm(10,200,30)), t = c(rep(0,10), rep(1,10), rep(2,10))

when I do:


the abline is a straight line through the centre of the points of each of the groups.

If, however, I factorise the groups (in order to do e.g. anova analysis) and then plot the data


the abline is now shifted up and to the left of where I would expect the line to go (through the centre of the points of each of the groups).

If there is a simple explanation, could someone tell me it?                   

To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre.

        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Aug 04 00:30:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:39 EST