Re: [R] details about lm()

From: <>
Date: Mon 10 Oct 2005 - 23:48:53 EST

Uwe Ligges a écrit :

> wrote:

>> Domenico Cozzetto a écrit :
>>> Dear all,
>>> I'd like to get a linear regression of some data, and impose that the 
>>> line
>>> goes through a given point P. I've tried to use the lm() method in the
>>> package "stats", but I wasn't able to specify the coordinates of the 
>>> point P. Maybe I should use another method?
>> add directly P in your data is also a way

> No!

Sorry indeed for my not at all rigourous answer. Adding P in the data set will indeed not force the regression line to pass through P (P will only be one more points of the cloud, adding P will "attract" the regression line, not more.)

I did make this answer because I'm yet working with very small data sets, and adding P (in more than one exemplar when needed in order to give it more weight), is a fast, (a bit ugly I agree), way to do. But on the kind of data I use, it works good enough. I should have add this precision. Apologies.

> Please, both of you, consult a basic textbook on linear regression.

If you have a good reference or link in mind, I would thank you.

> You can transform the data (linear) so that P becomes (0,0), after that
> you can estimate the slope without intercept by specifying
> lm(y ~ x - 1)
> The slope estimate is still valid while your intercept can be calculated
> afterwards.

Sorry for my lack of knowledge, but will the above trick really force the regression line to pass through P ?
adding (0,0) in this new system of coordinates isn't it equivalent to
add P to the dataset in the original system ?

If my question is too basic and/or too stupid, just give it a rest.

Vincent mailing list PLEASE do read the posting guide! Received on Mon Oct 10 23:53:07 2005

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