Logo

SQL Server KSP Function

Updated 2024-03-08 16:53:28.520000

Description

Use the scalar function KSP to calculate the Kolmogorov-Smirnov (KS) cumulative distribution function. 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].[KSP] (
   <@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.

Pks(0) = 0.

Pks(∞) = 1.

Examples

SELECT wct.KSP(1) as KSP;

This produces the following result.

KSP
0.730000328322645