

These files build C++ programs for computing the (complementary)cdf of the two-sided one sample Kolmogorov-Smirnov (KS) test statistic (Dn) when the underlying cdf is (dis)continuous, using Fast Fourier Transform (FFT) method.


# Building the binaries

I've tried to build the code on Linux and Mac OSX only. Building on Windows should be possible (e.g. using MinGW or some other GCC installation), but I haven't tried it.

Prerequisite: The [FFTW3](http://www.fftw.org/) library. [Installation instructions](http://www.fftw.org/download.html).

# 
The executable file to generate results for each table has been provided.

#
To calculate the (complementary)cdf of the two-sided one sample KS test statistic, (P(Dn >= q)), when the underlying cdf is (dis)continuous, in the command line tool (e.g., bash), 1. We set the current directory to where the folder “Exact_KS_FFT_replication_result” is located. 
2. Then, we run “make” to build the executable “crossprob” in the command line tool. 
3. Then, we run “./bin/crossprob TableXX Boundary_Crossing_Time.txt” in the command line tool.

The values of the (complementary)cdf and the corresponding computation times will be printed in the file “Table_XX.txt” located in the folder “Exact_KS_FFT_replication_result”. 

Note that possible inputs of ‘TableXX’ are 'Table1', 'Table2', 'Table3', 'Table4', 'Table5', 'Table6', 'Table8_13', 'Table14_16', 'Table17', 'Table18', 'Table19_21', 'Table22', or 'Table24’.

#
For example, if we want to replicate Table1 on Page 17 of the manuscript, we first change the current directory to where the folder “Exact_KS_FFT_replication_result” is located in the command line tool.

Then, in the command line tool, we run “./bin/crossprob Table1 Boundary_Crossing_Time.txt”.

The values of the (complementary)cdf and the corresponding computation times will be printed in the file “Table_1.txt” located in the folder “Exact_KS_FFT_replication_result”.  

## Build errors?

If you installed FFTW3 on your system, the compilation should just work. If FFTW3 is not installed system-wide (e.g. because you do not have root privileges) then before configuring and building you need to:
* Build FFTW3.
* Add -I<FFTW include dir location> (pointing to wherever "fftw3.h" is located) to CXXFLAGS in the Makefile.
* Add the directory containing libfftw3 to the path in the environment variable LD_LIBRARY_PATH (on linux) or DYLD_LIBRARY_PATH (on OSX).


# Contact

Feel free to ask any questions: senren.tan@cass.city.ac.uk

Senren Tan.

