Grzenio
Grzenio

Reputation: 36639

Normality tests in C++ or java (statistics)

I am looking for a library in C/C++ or java (or easily callable from those) that implements statistical normality tests: http://en.wikipedia.org/wiki/Normality_test

I had a quick look at boost and GSL, but they don't seem to include these.

I would appreciate links and examples how to use these tests (e.g. I am not sure how to link R libraries)

I would preferably work under Linux, but this is a secondary requirement.

Upvotes: 5

Views: 4087

Answers (1)

Jason S
Jason S

Reputation: 189626

See the Kolmogorov-Smirnov test. It's pretty simple -- you sort your data to get an array containing the population CDF, and compute the ideal CDF for a normal distribution with the population mean + standard deviation. Then iterate over the array and calculate the maximum deviation between the population CDF and the ideal CDF. Then plug it into the K-S distribution for a given degree of confidence.

All but the last part is trivial to implement in either language -- in Java here's one class to do that from Apache Commons.

See my answer to Benford's Law in Java - how to make a math function into Java for more details (different distribution, same idea though).

Upvotes: 3

Related Questions