PDF version (NAG web site
, 64-bit version, 64-bit version)
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
Description
Let be the sample cumulative distribution function and the hypothesised theoretical distribution function.
nag_stat_prob_kolmogorov1 (g01ey) returns the upper tail probability,
, associated with the one-sided Kolmogorov–Smirnov test statistic
or
, where these one-sided statistics are defined as follows;
If
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:
– int64int32nag_int scalar
-
, the number of observations in the sample.
Constraint:
.
- 2:
– double scalar
-
Contains the test statistic, or .
Constraint:
.
Optional Input Parameters
None.
Output Parameters
- 1:
– double scalar
The result of the function.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
-
-
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
The large sample distribution used as an approximation to the exact distribution should have a relative error of less than % for most cases.
Further Comments
The upper tail probability for the two-sided statistic, , can be approximated by twice the probability returned via nag_stat_prob_kolmogorov1 (g01ey), that is . (Note that if the probability from nag_stat_prob_kolmogorov1 (g01ey) is greater than then the two-sided probability should be truncated to ). This approximation to the tail probability for is good for small probabilities, (e.g., ) but becomes very poor for larger probabilities.
The time taken by the function increases with , until . At this point the approximation is used and the time decreases significantly. The time then increases again modestly with .
Example
The following example reads in different sample sizes and values for the test statistic . The upper tail probability is computed and printed for each case.
Open in the MATLAB editor:
g01ey_example
function g01ey_example
fprintf('g01ey example results\n\n');
n = zeros(10,1,'int64');
n(1: 5) = 10;
n(6:10) = 400;
d = [0.323; 0.369; 0.409; 0.457; 0.489; 0.0535; 0.061; 0.068; 0.076; 0.0815];
fprintf(' d n one-sided probability\n');
for j = 1:numel(d)
[p, ifail] = g01ey( ...
n(j), d(j));
fprintf('%8.4f%6d%17.4f\n', d(j), n(j), p);
end
g01ey example results
d n one-sided probability
0.3230 10 0.0994
0.3690 10 0.0497
0.4090 10 0.0251
0.4570 10 0.0099
0.4890 10 0.0050
0.0535 400 0.1001
0.0610 400 0.0502
0.0680 400 0.0243
0.0760 400 0.0096
0.0815 400 0.0048
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015