cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Newbie

## How to find correlation coefficient for 3-D polynomial regression

Hello all,

I'm working with a set of 3-D data (2 independent variables, 1 dependent value) in which I'm using the regress and interp functions to find a 3rd degree polynomial function to describe it. I have looked through the help and quicksheets and it appears that MathCAD does not automatically calculate the correlation coefficient for such a regression, so I'm wondering if there is something close in definition to a correlation coefficient to help me quantify the accuracy of the best-fit plane. I'm basically trying to quantify the fit difference between a 2nd-order polynomial, 3rd order, and 4th order.

Any help is appreciated!

Attached is a little eye candy of the a best-fit plane and superimposed data.

Tags (7)
14 REPLIES 14

## Re: How to find correlation coefficient for 3-D polynomial regression

[deleted content]

. Why not a spline fit for that surface.

Good idea to check thw qs for "Regress",

Minerr ... fit "

jmG

## Re: How to find correlation coefficient for 3-D polynomial regression

I'm afraid I don't understand your post. I'm trying to figure out how to calculate the correlation coefficient for the best-fit surface, what's the problem? A best-fit spline doesn't help me because:

1. The 3rd order polynomial fit is obviously an excellent fit. I need to quantify "excellent" however.
2. I need to take the polynomial equation for the best-fit plane, and use it in the control software for this application. I can't give an interpolated spline equation to the control system!

As for your comment regarding the tags, I simply added some tags to make it easier to find this thread using a keyword search. That's what they're there for...

## Re: How to find correlation coefficient for 3-D polynomial regression

See here:

(long URL!!!)

But I think that's overkill. If you want to compare the difference in the quality of different fits to the same data all you really need is the sum of the squares of the residuals (i.e. sum[(z-fit)^2]).

## Re: How to find correlation coefficient for 3-D polynomial regression

 Mech_Engineer wrote:I'm afraid I don't understand your post.

Don't worry about it. Neither do I

 The 3rd order polynomial fit is obviously an excellent fit. I need to quantify "excellent" however.

Be very careful regarding what you mean by "quantify". You can use the correlation coefficient to judge the difference between the quality of different fits to the same data, but do not make the mistake of over interpreting it. For example, you cannot use it to compare different fits of the same function to completely different data.

## Re: How to find correlation coefficient for 3-D polynomial regression

 Mech_Engineer wrote:I'm afraid I don't understand your post. I'm trying to figure out how to calculate the correlation coefficient for the best-fit surface, what's the problem? A best-fit spline doesn't help me because:The 3rd order polynomial fit is obviously an excellent fit. I need to quantify "excellent" however.I need to take the polynomial equation for the best-fit plane, and use it in the control software for this application. I can't give an interpolated spline equation to the control system!As for your comment regarding the tags, I simply added some tags to make it easier to find this thread using a keyword search. That's what they're there for...

If the 3rd order polynomial is your choice, then just plot the residuals to the fit and the data. My point about your tags is that up until now it does not help any visitor whereas at your 2nd visit you have no work sheet. Eventually if your project is interesting, some collab might just generalise and repost under another thread, then tag appropriately. There is no "best fit spline" ,spline surface only and the most common Mathcad splines are cubic !

Attach the sheet, that will shorten the discours.

jmG

## Re: How to find correlation coefficient for 3-D polynomial regression

1. Standard error estimate

2. Leverage

3. "Studentized" residuals

5. Constant error variance,

6. Durbin_Waton ststistics,

7. Pearson correlation

8. Euclidean error

jmG

## Re: How to find correlation coefficient for 3-D polynomial regression

I think I'll just sum the squares of the residuals. I was hoping there was a built-in function that I could call, but alas there is not.

Thanks for the help Richard.

## Re: How to find correlation coefficient for 3-D polynomial regression

 Mech_Engineer wrote:I think I'll just sum the squares of the residuals. I was hoping there was a built-in function that I could call, but alas there is not.Thanks for the help Richard.

The Mathcad built-in ERR is paired with Minerr

jmG

## Re: How to find correlation coefficient for 3-D polynomial regression

I think you should be careful about using polynomial fits, particularly if there is no rational physical explanation for using a polynomial, and particularly if there is any sort of noise in the data.

Philosophically, regression attempts to "thread" the data, i.e., picking the smooth path that is equidistant from all data points as an ensemble. A polynomial fit will undulate to miinimize the distance function to the points, so while a 3rd order might an "excellent" fit, a 4th order will result in even lower residuals, and a 5th order will result in still lower residuals. In fact, it may well be that a 3rd order is already twisting to minimize the residuals, and will not necessarily be appropriate for a fitting function that is used to predict performance.

TTFN

Announcements