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
 KS test, Cumulative fraction plot
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

kr5z

USA
Posts

Posted - 05/31/2006 :  12:28:01 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR6
Operating System: XP

Hello: I am a new user of Origin and would appreciate if anybody could tell me if its possible to perform a KS test in Origin.

I would also like to know if its possible and if so, how to generate a cumulative fraction plot by importing values from a spreadsheet.

Thanks a lot!
Karthik

minimax

348 Posts

Posted - 05/31/2006 :  9:58:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Karthik,

Does the KS test mean for one-sample Kolmogorov-Smirnov test?

If so, currently Origin7.5 does not directly provide the KS test. However, since Origin includes many functions from NAG (the Numerical Algorithms Group library), now you can carry out the test simply by a patch of OriginC codes.

Copy the following codes into Origin workspace, compile it, type ks_test in the script window and then press Enter key to execute it.
If you are fresh to the programming, you can refer to the Origin programming help file: Code Builder User Guide: Introduction. This chapter explains the basics of how to program with the code builder.


#include <NAG\OCN_g08.h>
void ks_test()
{
// suppose the active window is a worksheet
Worksheet wks = Project.ActiveLayer();
if(!wks)
return;

// suppose the test data is stored in column(A)
Dataset dsA(wks,0);
vector vData =dsA;

int nRet;

double par[2];
Nag_ParaEstimates estima;
estima = Nag_ParaEstimated;

Nag_TestStatistics dtype;
dtype = Nag_TestStatisticsDAbs;
double dD, dZ, dP;

// perform a one sample Kolmogorov-Smirnov test to examine if the data obeys Normal distribution
nRet = nag_1_sample_ks_test(vData.GetSize(), vData, Nag_Normal, par, estima, dtype, &dD, &dZ, &dP);

// output test results, where "Tail probability" tells the probability that the data is from a Normal distribution
printf("Test against Normal distribution with parameters estimated from the data\n");
printf("\n");
printf("Mean = %8.4f\n", par[0]);
printf("Variance = %8.4f\n", par[1]);
printf("Test statistics D = %8.4f\n", dD);
printf("Z statistic = %8.4f\n", dZ);
printf("Tail probability = %8.4f\n", dP);
}


For more detail on the usage of the function nag_1_sample_ks_test(), you can turn to g08cbc document inside folder \NAG PDFs. (If you did not install the PDFs previously, you can install them by running the Origin "Add or Remove Files" program.)

Moreover, if your KS test means for two-sample Kolmogorov-Smirnov test, you can look at function nag_2_sample_ks_test() and create similar codes to test.

With regards to the cumulative fraction plot, you can simply use menu plot--Statistical Graphs--Histogram+Probablities to create a desirable graph.

Hope it works. If you still encounter any problems, feel free to contact our Technical Support

Max
OriginLab GZoffice
Go to Top of Page

kr5z

USA
Posts

Posted - 08/18/2006 :  3:59:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry for the belated reply and thank you for the suggestions. I will try it out.
Karthik
Go to Top of Page

minimax

348 Posts

Posted - 08/18/2006 :  8:08:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Karthik,

You are welcome.

BTW, the KS tests will be implemented directly in the next coming version of Origin, Origin8. At that time, I think you can use it more flexibly.

Max
OriginLab GZoffice
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