Finding a Best-Fit Regression PlaneDate: 12/15/2005 at 12:31:37 From: Brad Subject: Best Fit Regression Planes Dr. Math, I have a height map of a certain terrain where the x and y values are fixed. The dataset is in the form of a spreadsheet. The spreadsheet program I used was able to calculate my best-fit slopes in the x and y directions, but I cannot figure out how to combine these slopes into a unique best-fit regression plane. I want the regression plane to minimize only the z distances from my original points; the x and y points will remain fixed. So far, I have been able to figure the best fit of the plane for x and y. What I'm trying to figure out is with the best fit data, where does one start to create a plane? Date: 12/16/2005 at 06:57:57 From: Doctor George Subject: Re: Best Fit Regression Planes Hi Brad, Thanks for writing to Doctor Math. Let your N points be (xi,yi,zi) and let your plane be z = f(x,y) = a*x + b*y + c We want to find a, b and c such that N g(a,b,c) = SUM[(a*xi + b*yi + c - zi)^2] i=1 is minimized. Now take the partial derivative of g with respect to a and set it equal to zero. Do the same for b and c. This will give you three linear equations to solve for a, b and c. You can make it even more compact if you recognize that the partial derivative with respect to c leads to the conclusion that the regression plane contains the centroid of the data. Then you can write the plane as z = f(x,y) = a*(x-xo) + b*(y-y0) + z0 where (x0,y0,z0) is the centroid. Now you just need to solve for a and b in the same way described above. Does that make sense? Write again if you need more help. - Doctor George, The Math Forum http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994- The Math Forum at NCTM. All rights reserved.
http://mathforum.org/dr.math/