[R] Fit a 3-Dimensional Line to Data Points

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Fri Jul 25 10:31:15 CEST 2008


> I am new to R, and was wondering how to do 3D linear
> regression in R. In other words, I need to Fit a
> 3-Dimensional Line to Data Points (input).
> 
> I googled before posting this, and found that it is
> possible in Matlab and other commercial packages. For
> example, see the Matlab link:
> http://www.mathworks.com/products/statistics/demos.html?
> file=/products/demos/shipping/stats/orthoregdemo.html#10
> 
> Is there a way to achieve this in R?

Being picky, I think you mean you want to fit a line to 3-dimensional data 
points (since a line is by definition 1-dimensional).

In R, you can find a line of best fit to data with an arbitrary number of 
dimensions using the function 'line'.  Type ?line for help, and 
example(line) to see how the function is used.

If the problem is a linear regression, use the function 'lm' instead.

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



More information about the R-help mailing list