Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Normality tests in C++ or java (statistics)

Tags:

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.

like image 326
Grzenio Avatar asked Oct 23 '22 13:10

Grzenio


1 Answers

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

like image 101
Jason S Avatar answered Jan 02 '23 20:01

Jason S