Simple C code for applying Kolmogorov test and test Stephens result
To compile the code just run make in the project dir.
make
After compilation 3 executables will be generated: deviation_statistics
, simulate_data
and stephens
Download the MinGW compiler: 'http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/installer/mingw-w64-install.exe/download' In MinGW terminal and run the command:
mingw32-make
After compilation 3 executables will be generated: deviation_statistics.exe
, simulate_data.exe
and stephens.exe
This project contains 3 executalbe programs each of them will be described in the next chapter
This program is used to generate set of random variables.
./simulate_data <type> <file_name> <number_of_points>
<type> - currently supported - are gauss or pseudo gauss.
<file_name> - output file name
<number_of_points> - the number of the generated points
./simulate_data gauss test_1000.txt 1000
simulate_data.exe gauss test_1000.txt 1000
This example will produce file test_1000.txt
witl the following content:
$ head -n 5 test_1000.txt
#1000
0.693775
2.050064
-0.022952
-0.934158
$
M. A. Stephens, "EDF Statistics for Goodness of Fit and Some Comparisons" J. of Amer. Statist. Assoc., 69, 730-737 (1974). http://www.math.utah.edu/~morris/Courses/6010/p1/writeup/ks.pdf Empirical Distribution Function EDF F[i]. Reject hypothesis at chosen level of significance. (double) sqN= sqrt(n) - .01 + .85/sqrt(n); Probability{max [sqNfabs(F-F^)]>D}=alpha Table 1, 1.3 Modification, mu and sigma unknown. D_alpha refers to upper tail critical value of the Kolmogorov-Smirnov statistics at level alpha, giving a (1-alpha) confidential interval.
./stephens <file_name>
./stephens test_1000.txt
stephens.exe test_1000.txt
The first line of the input file should contain the number of random variables in the file. Like:
$ head -n 5 test_1000.txt
#1000
0.693775
2.050064
-0.022952
-0.934158
$
This program is used to calculate sqrt(N)*D_N as function of N
./deviation_statistics test 1000000
deviation_statistics.exe test 1000000