Re: [R] details about lm()

From: <vincent_at_7d4.com>
Date: Tue 11 Oct 2005 - 01:38:38 EST

Uwe Ligges a écrit :

> vincent@7d4.com wrote:

>> 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 ?

>
> Well, you do not add that point, but transform the others:
> Say you have (let's make a very simple 1-D example) points P_i = (x_i,
> y_i), and P = (x_0, y_0). Then calculate for all i:
> P'_i = (x_i - x_0, y_i - y_0)
> Now you can calculate a regression without any Intercept by
> lm(y ~ x - 1)
> You got the slope now and the Intercept is 0 so far for P'.
> After that, you can re-transform to get the real data's intercept:
> Intercept = -(slope * x_0) + y_0

Thank you very much for the kind answer and for your time. (I'll read that carefully and take my rule, pencil and R). Vincent



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 Tue Oct 11 02:12:11 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:37:59 EST