KScdf
Updated 2023-11-03 16:02:28.940000
Syntax
SELECT [westclintech].[wct].[KScdf](
<@n, int,>
,<@k, float,>)
Description
Use the scalar function KSccdf to compute the cumulative probability P[D n >= x] of the Kolmogorov-Smirnov distribution with sample size n at x.
Arguments
@x
is the maximum magnitude of the discrepancy between the empirical and proposed distributions. @x is an expression of type float or of a type that can be implicitly converted to float.
@n
is the sample size. @n is an expression of type int or of a type that can be implicitly converted to int.
Return Type
float
Remarks
If @n < 0 then KScdf = 1.
If @x < 0 then KScdf = 1.
Examples
SELECT n,
sqrt(18.0 / n) as x,
wct.KSCDF(n, sqrt(18.0 / n)) as ks
FROM
(
VALUES
(50.0),
(100.0),
(500.0),
(1000.0),
(5000.0),
(10000.0),
(50000.0),
(10E5),
(10E6),
(10E7),
(10E8)
) p (n);
This produces the following result.
{"columns":[{"field":"n","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"x","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"},{"field":"ks","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"n":"50","x":"0.6","ks":"1"},{"n":"100","x":"0.424264068711929","ks":"1"},{"n":"500","x":"0.189736659610103","ks":"1"},{"n":"1000","x":"0.134164078649987","ks":"1"},{"n":"5000","x":"0.06","ks":"1"},{"n":"10000","x":"0.0424264068711929","ks":"1"},{"n":"50000","x":"0.0189736659610103","ks":"1"},{"n":"1000000","x":"0.00424264068711928","ks":"0.999999999999956"},{"n":"10000000","x":"0.00134164078649987","ks":"0.999999999999956"},{"n":"100000000","x":"0.000424264068711929","ks":"0.999999999999956"},{"n":"1000000000","x":"0.000134164078649987","ks":"1"}]}