hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_stat_prob_kolmogorov1 (g01ey)

Purpose

nag_stat_prob_kolmogorov1 (g01ey) returns the upper tail probability associated with the one sample Kolmogorov–Smirnov distribution.

Syntax

[result, ifail] = g01ey(n, d)
[result, ifail] = nag_stat_prob_kolmogorov1(n, d)

Description

Let Sn(x)Sn(x) be the sample cumulative distribution function and F0(x)F0(x) the hypothesised theoretical distribution function.
nag_stat_prob_kolmogorov1 (g01ey) returns the upper tail probability, pp, associated with the one-sided Kolmogorov–Smirnov test statistic Dn + Dn+ or DnDn-, where these one-sided statistics are defined as follows;
Dn + = supx[Sn(x)F0(x)],
Dn = supx[F0(x)Sn(x)[.
Dn+ = supx[Sn(x)-F0(x)], Dn- = supx[F0(x)-Sn(x)[.
If n100n100 an exact method is used; for the details see Conover (1980). Otherwise a large sample approximation derived by Smirnov is used; see Feller (1948), Kendall and Stuart (1973) or Smirnov (1948).

References

Conover W J (1980) Practical Nonparametric Statistics Wiley
Feller W (1948) On the Kolmogorov–Smirnov limit theorems for empirical distributions Ann. Math. Statist. 19 179–181
Kendall M G and Stuart A (1973) The Advanced Theory of Statistics (Volume 2) (3rd Edition) Griffin
Siegel S (1956) Non-parametric Statistics for the Behavioral Sciences McGraw–Hill
Smirnov N (1948) Table for estimating the goodness of fit of empirical distributions Ann. Math. Statist. 19 279–281

Parameters

Compulsory Input Parameters

1:     n – int64int32nag_int scalar
nn, the number of observations in the sample.
Constraint: n1n1.
2:     d – double scalar
Contains the test statistic, Dn + Dn+ or DnDn-.
Constraint: 0.0d1.00.0d1.0.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     result – double scalar
The result of the function.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:
  ifail = 1ifail=1
On entry,n < 1n<1.
  ifail = 2ifail=2
On entry,d < 0.0d<0.0,
ord > 1.0d>1.0.

Accuracy

The large sample distribution used as an approximation to the exact distribution should have a relative error of less than 2.52.5% for most cases.

Further Comments

The upper tail probability for the two-sided statistic, Dn = max (Dn + ,Dn)Dn=max(Dn+,Dn-), can be approximated by twice the probability returned via nag_stat_prob_kolmogorov1 (g01ey), that is 2p2p. (Note that if the probability from nag_stat_prob_kolmogorov1 (g01ey) is greater than 0.50.5 then the two-sided probability should be truncated to 1.01.0). This approximation to the tail probability for DnDn is good for small probabilities, (e.g., p0.10p0.10) but becomes very poor for larger probabilities.
The time taken by the function increases with nn, until n > 100n>100. At this point the approximation is used and the time decreases significantly. The time then increases again modestly with nn.

Example

function nag_stat_prob_kolmogorov1_example
n = int64(10);
d = 0.323;
[result, ifail] = nag_stat_prob_kolmogorov1(n, d)
 

result =

    0.0994


ifail =

                    0


function g01ey_example
n = int64(10);
d = 0.323;
[result, ifail] = g01ey(n, d)
 

result =

    0.0994


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013