KSccdf
Updated 2023-11-03 16:00:00.023000
Syntax
SELECT [westclintech].[wct].[KSccdf](
<@n, int,>
,<@k, float,>)
Description
Use the scalar function KSccdf to compute the complementary 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 KSccdf = 1.
If @x < 0 then KSccdf = 1.
Examples
SELECT n,
sqrt(18.0 / n) as x,
wct.KSCCDF(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":"9.6340704561422E-18"},{"n":"100","x":"0.424264068711929","ks":"7.60653219848608E-17"},{"n":"500","x":"0.189736659610103","ks":"3.09340954271647E-16"},{"n":"1000","x":"0.134164078649987","ks":"3.69599264243387E-16"},{"n":"5000","x":"0.06","ks":"4.33712332368773E-16"},{"n":"10000","x":"0.0424264068711929","ks":"4.44862619998983E-16"},{"n":"50000","x":"0.0189736659610103","ks":"4.56828378005821E-16"},{"n":"1000000","x":"0.00424264068711928","ks":"4.62531376662394E-16"},{"n":"10000000","x":"0.00134164078649987","ks":"4.63483518913332E-16"},{"n":"100000000","x":"0.000424264068711929","ks":"4.63772741835367E-16"},{"n":"1000000000","x":"0.000134164078649987","ks":"4.63863011932784E-16"}]}