For example I have the variables x, y (or higher dimensional data in general) and a probability density distribution p(x,y). I want to approximate p(x,y) as a linear function, a plane in this case, at least somewhere in the domain. However I only have samples from the distribution. In case of big amount of data the easy way is to collect them into bins, and fit a plane onto the estimated density function. But I dont want to compress data, I would like to extract the maximum information and use the points itself. Are there any method to do this? Once more: I do not have (x,y,z) triples, I only have (x,y) samples from the p(x,y) density.

  • $\begingroup$ this is the so called "density estimation" problem $\endgroup$ – sceptic Feb 18 '15 at 16:11

I recalled that the "Graphics Gems" series of books had a routine that did this, so I did a Google search for "fit a plane to data graphics gems".

One of the hits was this: "Graphics Gems, by Category" at http://tog.acm.org/resources/GraphicsGems/category.html.

This was what I was looking for there:

Tampieri, Filippo, Newell's Method for the Plane Equation of a Polygon, Graphics Gems III, p. 231-232, code: p. 517-518, newell.c.

The code is here: http://tog.acm.org/resources/GraphicsGems/gemsiii/newell.c

The routine is quite short, less than 30 lines long.

A little more searching turned up this:


This is a very good resource - highly recommended.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.