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

From: <>
Date: Fri, 25 Jul 2008 09:31:15 +0100

> 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:
> 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.


Mathematical Sciences Unit

ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 25 Jul 2008 - 08:33:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 25 Jul 2008 - 12:32:08 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive