SQL Server KSQ Function
Updated 2024-03-08 16:57:12.080000
Description
Use the scalar function KSQ to calculate the complementary Kolmogorov-Smirnov (KS) cumulative distribution function, Qks = 1 - Pks. The equation for the cumulative distribution function is:
\operatorname{P}_{ks}(z)=1-2\sum_{j=1}^\infty (-1)^{j-1} e^{-2j^2 z^2}
Syntax
SELECT [westclintech].[wct].[KSQ] (
<@z, float,>)
Arguments
@z
is the value at which to evaluate the function. @z is an expression of type float or of a type that can be implicitly converted to float.
Return Type
float
Remarks
@z must greater than or equal to 0.
Qks(0) = 1.
Qks(∞) = 0.
Examples
SELECT wct.KSQ(1) as KSQ;
This produces the following result.
| KSQ |
|---|
| 0.269999671677355 |