# How to use a custom CDF in a Kolmogorov-Smirnov test

How do I use a custom CDF that I defined for a Kolmogorov-Smirnov test. I have one input vector of data whose CDF I claim to have derived but want to check whether it agrees with my closed form result. In order to do so, I am wondering whether there is a way to feed the command not just two data vectors but one data vector and one CDF.

In http://reference.wolfram.com/language/ref/KolmogorovSmirnovTest.html, one can only specify the distributions by name but mine is a new one that has no name (yet;-)).

Thanks!

Hirek

• here CDF = cumulative distribution function (not our favorite document format) – Gustavo Delfino Sep 12 '14 at 7:49

You can use ProbabilityDistribution to define your own probability distribution from a CDF:

dist = ProbabilityDistribution[{"CDF", 1/2 Erfc[(0.1 - x)/(Sqrt[2] 1.2)]}, {x, -∞, ∞}]


With some data

data = RandomVariate[NormalDistribution[], 50];


you can now perform

KolmogorovSmirnovTest[data, dist]