The null hypothesis is that each $\xi_i$ is independently distributed with CDF $F(x)$.

We want to know how large or small $D_n$ needs to be before deciding whether to reject the null hypothesis. The following Theorem offers a remarkable answer to this problem.

\[chap\_4\_thm\_ks\_test\] Suppose the null hypothesis is true, then the distribution of $D_n$ depends only on $n$.

This distribution is called the KS distribution. There is a Theorem which describes the asymptotic behaviour of the KS distribution.

In the limit $n \longrightarrow \infty$, $\sqrt{n}D_n$ is asymptotically Kolmogorov distributed with the CDF $$Q(x)=1-2\sum_{k=1}^\infty (-1)^{k-1}e^{-2k^2x^2}$$ that is to say $$\lim_{n\longrightarrow \infty} P(\sqrt{n} D_n \leq x)=Q(x).$$

### Conditional Kolmogorov-Smirnov Test

This conditional Kolmogorov-Smirnov Test is developed in the paper[@tommy_paper_A] and the thesis [@tommy_thesis]. Let $\zeta_1,\zeta_2,\ldots,\zeta_n$ be $n$ iid real random variables. They are $n$ empirical observations of a random variable $\zeta$. Now suppose that each of the $\xi_1,\xi_2,\ldots,\xi_n$ is conditioned and dependent on the corresponding $\zeta_1,\zeta_2,\ldots,\zeta_n$. The conditional CDF $F(\cdot,\cdot)$ is $$\begin{aligned}
P(\xi_i\leq x\,|\,\zeta_i)=F_{\zeta_i}(x)=\int^x_{-\infty}f(s,\zeta_i)\,ds.\end{aligned}$$ But $\xi_1,\xi_2,\ldots,\xi_n$ are empirical measurements of the same random variable $\xi$. The CDF for $\xi$ is $$\begin{aligned}
P(\xi\leq x)=F(x)=\int^x_{-\infty}\int^{u=+\infty}_{u=-\infty}f(s,u)m(u)\,du\,ds\end{aligned}$$ where $m(\cdot)$ is the PDF for $\zeta$. In our context we have the problem that the random variables 