[R] intercept of 3D line? (Orthogonal regression)
William Simpson
william.a.simpson at gmail.com
Tue Sep 2 13:17:00 CEST 2008
OK thanks Moshe I will think about your answer.
Cheers
Bill
On Tue, Sep 2, 2008 at 5:55 AM, Moshe Olshansky <m_olshansky at yahoo.com> wrote:
> I do not see why you can not use regression even in this case.
>
> To make things more simple suppose that the exact model is:
>
> y = a + b*x, i.e.
> y1 = a + b*x1
> ...
> yn = a + b*xn
>
> But you can not observe y and x. Instead you observe
> ui = xi + ei (i=1,...,n) and
> vi = yi + di (i=1,...,n)
>
> Now you have
>
> vi = yi + di = a + b*xi + di = a + b*(ui - ei) + di
> = a + b*ui + (di - b*ei)
>
> and under regular assumptions about ei's end di's we get a standard regression problem (note that b is unknown to you but is constant).
>
>
> --- On Tue, 2/9/08, William Simpson <william.a.simpson at gmail.com> wrote:
>
>> From: William Simpson <william.a.simpson at gmail.com>
>> Subject: [R] intercept of 3D line? (Orthogonal regression)
>> To: r-help at r-project.org
>> Received: Tuesday, 2 September, 2008, 4:53 AM
>> I posted before recently about fitting 3D data x, y, z where
>> all have
>> error attached.
>> I want to predict z from x and y; something like
>> z = b0 + b1*x + b2*y
>> But multiple regression is not suitable because all of x,
>> y, and z have errors.
>>
>> I have plotted a 3D scatterplot of some data using rgl. I
>> see that the
>> data form a cigar-shaped cloud. I think multiple regression
>> is only
>> suitable when the points fall on a plane (forgetting about
>> the error
>> in x and y).
>>
>> I now know the right way how to find the best fitting plane
>> to x,y,z
>> data using princomp.
>> But a new problem is how to get the best fitting *line*. I
>> actually
>> know how to do that too using princomp. But there is a
>> mathematical
>> problem: there's no way to specify a line in 3D space
>> in the form
>> z=f(x,y) or in other words with an intercept and slopes.
>> Instead, one way to deal with the problem is to use a
>> parametric
>> version of the line: you use an arbitrary starting point
>> x0, y0, z0
>> and the direction vector of your line (I know how to get
>> the direction
>> vector).
>>
>> BUT how do I get the intercept??? At this point my lines
>> just go
>> through the origin.
>> Do I just use $center from the princomp output modified in
>> some way?
>>
>> Thanks for any help!
>>
>> Cheers
>> Bill
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained,
>> reproducible code.
>
More information about the R-help
mailing list