The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Polynomial Fitting Problem?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Charles.A.1

USA
9 Posts

Posted - 05/01/2001 :  3:26:28 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I fitted a data set to a 6th order polynomial using the fitting tool and when I manually calculated the resulting plot data using the resulting equation and (hidden)data, I got different answers. I tried this procedure with a similar data set before and got a correct match up. What's the deal?

rtoomey

USA
184 Posts

Posted - 05/02/2001 :  2:27:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

The resulting "plot data" (i.e. the red fit curve) is generated by Origin using internally stored parameter results. These results are a lot more accurate (i.e. they have more precision to the right of the decimal point) than the results reported to the Results Log. This is most likely the reason why your manual calculations do not always match our fit results. Therefore, it is recommended that you use these internal values at ALL times (for manual calculations).



To get at them (for polynomial regression), use the stat.pr sub-object properties. In the case of a 6th order polynomial regression, the specific properties are:




- stat.pr.a
- stat.pr.b1
- stat.pr.b2
- stat.pr.b3
- stat.pr.b4
- stat.pr.b5
- stat.pr.b6


As a simple example, suppose you have just performed a 2nd order polynomial fit. You now have access to stat.pr.a, stat.pr.b1, and stat.pr.b2. Suppose further that column 3 of the active worksheet is an X column which is full of arbitrary values. To calculate the 2nd order polynomial result using that X column and then place it in column 4, you could execute the following in the Script window (or the right-hand side of it in the Set Column Values dialog box after selecting column 4 and Column:Set Column Values):

col(4)=stat.pr.a+stat.pr.b1*col(3)+stat.pr.b2*(col(3)^2);

Note: If you were performing a linear fit, the stat.lr sub-object would need to be used. If you were performing a nonlinear fit, the nlsf object would need to be used. Objects, object properties, and object methods are all described in the LabTalk Manual and LabTalk Help File (Help:LabTalk).

I hope this information proves helpful.

- rtoomey


Go to Top of Page

Charles.A.1

USA
9 Posts

Posted - 05/02/2001 :  5:45:13 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Wow! Your recommended procedure works great. Thanks alot. (By the way, your example formula for the 2nd order polynomial fit was missing a factor (i.e. col(4)=stat.pr.a + stat.pr.b1*col(3) + stat.pr.b2*(col(3)^2)).

Go to Top of Page

rtoomey

USA
184 Posts

Posted - 05/04/2001 :  09:52:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Woops! Thanks for catching that! I have updated my original post.

- rtoomey

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000