Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- How to find correlation coefficient for 3-D polyno...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
06:07 PM

08-02-2010
06:07 PM

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.

Labels:

14 REPLIES 14

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
07:00 PM

08-02-2010
07:00 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
07:08 PM

08-02-2010
07:08 PM

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:

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
07:40 PM

08-02-2010
07:40 PM

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]).

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
07:46 PM

08-02-2010
07:46 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
08:02 PM

08-02-2010
08:02 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-02-2010
08:33 PM

08-02-2010
08:33 PM

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

To the SsE already suggested, add:

1. Standard error estimate

2. Leverage

3. "Studentized" residuals

4. Mathcad built-i corr(vx,vy)

5. Constant error variance,

6. Durbin_Waton ststistics,

7. Pearson correlation

8. Euclidean error

jmG

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-03-2010
02:55 PM

08-03-2010
02:55 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-03-2010
11:26 PM

08-03-2010
11:26 PM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-04-2010
12:37 AM

08-04-2010
12:37 AM

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