[R] intercept of 3D line? (Orthogonal regression)
William Simpson
william.a.simpson at gmail.com
Mon Sep 1 20:53:03 CEST 2008
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
More information about the R-help
mailing list