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 for Programming
 Forum for Origin C
 R-squared
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ovince

Yugoslavia
Posts

Posted - 11/26/2006 :  06:24:51 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
hi,


Could someboby help me to complete this statistical task.

I have a worksheet with X , Y data. I would like to fit polynoms (1 oreder, 2 order ...) to the data and to calculate the corresponding R-squared.

I have something like this:

void test()
{
...

//calculate R-square
string strB1 = "Data1_B"
LT_set_str("%P", strB1);
string LTcmdB1;
LTcmdB1 = "stat.data$=%P;"
"stat.lr();";
LT_execute(LTcmdB1);

double adrsqCB1;
LT_get_var("stat.adrsq", &adrsqCB1);

.....

}


how to 'tell' the program to calculate R-squared for 3 order polynom for example? Or for 2 order?


Thanks
oliver

Mike Buess

USA
3037 Posts

Posted - 11/26/2006 :  2:44:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Oliver,

R^2 is given by stat.cod but polynomial fit is stat.pr(), not stat.lr() (linear regression).

using stat = LabTalk.stat;
stat.reset();
stat.data$ = "Data1_B";
stat.pr.order = 1; // 1st order
stat.pr();
out_double("1st order: R^2=",stat.cod);
stat.pr.order = 2; // 2nd order
stat.pr();
out_double("2nd order: R^2=",stat.cod);

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 11/26/2006 2:46:01 PM
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