Login     Register

        Contact Us     Search

XLeratorDB/statistics Documentation

SQL Server Kolmogorov-Smirnov cumulative distribution function


KScdf

Updated: 29 June 2012


Use KSccdf to compute the cumulative probability P[Dn >= x] of the Kolmogorov-Smirnov distribution with sample size n at x.
Syntax
SELECT [wctStatistics].[wct].[KScdf](
  <@n, int,>
 ,<@k, float,>)
Arguments
@n
is the sample size. @n is an expression of type int or of a type that can be implicitly converted to int
@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. 
Return Types
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.
                     n                      x                     ks
---------------------- ---------------------- ----------------------
                    50                    0.6                      1
                   100      0.424264068711929                      1
                   500      0.189736659610103                      1
                  1000      0.134164078649987                      1
                  5000                   0.06                      1
                 10000     0.0424264068711929                      1
                 50000     0.0189736659610103                      1
               1000000    0.00424264068711928      0.999999999999956
              10000000    0.00134164078649987      0.999999999999956
             100000000   0.000424264068711929      0.999999999999956
            1000000000   0.000134164078649987                      1
 


Copyright 2008-2017 Westclintech LLC         Privacy Policy        Terms of Service