Perform a Kolmogorov-Smirnov test of the null hypothesis that the sample x comes from the (continuous) distribution dist. I.e., if F and G are the CDFs corresponding to the sample and dist, respectively, then the null is that F == G.
The optional argument params contains a list of parameters of dist. For example, to test whether a sample x comes from a uniform distribution on [2,4], use
kolmogorov_smirnov_test(x, "uniform", 2, 4)dist can be any string for which a function dist_cdf that calculates the CDF of distribution dist exists.
With the optional argument string alt, the alternative of interest can be selected. If alt is
"!="
or"<>"
, the null is tested against the two-sided alternative F != G. In this case, the test statistic ks follows a two-sided Kolmogorov-Smirnov distribution. If alt is">"
, the one-sided alternative F > G is considered. Similarly for"<"
, the one-sided alternative F > G is considered. In this case, the test statistic ks has a one-sided Kolmogorov-Smirnov distribution. The default is the two-sided case.The p-value of the test is returned in pval.
If no output argument is given, the p-value is displayed.