Fixed-Point Algorithm for Solving the Critical Value and Upper Tail Quantile of Kuiper’s Statistics
Abstract
Kuiper’s statistic is a good measure for the difference of ideal distribution and empirical distribution in the goodness-of-fit test. However, it is a challenging problem to solve the critical value and upper tail quantile, or simply Kuiper pair, of Kuiper’s statistics due to the difficulties of solving the nonlinear equation and reasonable approximation of infinite series. In this work, the contributions lie in three perspectives: firstly, the second order approximation for the infinite series of the cumulative distribution of the critical value is used to achieve higher precision; secondly, the principles and fixed-point algorithms for solving the Kuiper pair are presented with details; finally, finally, a mistake about the critical value for in Kuiper’s distribution table has been labeled and corrected where is the sample capacity and is the upper tail quantile. The algorithms are verified and validated by comparing with the table provided by Kuiper. The methods and algorithms proposed are enlightening and worth of introducing to the college students, computer programmers, engineers, experimental psychologists and so on.
Kerwords: Kuiper’s statistic; Upper tail quantile; Fixed-point;
Numerical approximation; Algorithm Design; STEM education
1 Introduction
In statistics, for two cumulative distribution functions (CDF) and , Kuiper’s test [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] is defined by
(1) |
where the discrepancy statistics
(2) |
represent the maximum deviation above and below the two cumulative distribution functions being compared, respectively. The trick with Kuiper’s test is to use the quantity as the test statistic instead of in Kolmogrov-Smirnov test. This small change makes Kuiper’s test as sensitive in the tails as at the median and also makes it invariant under cyclic transformations of the independent variable. The Kuiper’s test is useful for the goodness-of-fit test, also named by distribution fitting test. Exactly speaking, there are two types of Kuiper’s test [1]
-
•
-test, which is used for comparing two distributions with samples;
-
•
-test, which is used for comparing two distributions with and samples respectively.
Suppose that is the CDF of the Kuiper’s statistic , is the upper tail probability111The upper tail probability will be the upper tail significance level or the probability of first type error in hypothesis test. for the Kuiper’s test statistic and is the upper tail quantile (UTQ, also named upper tail fractile) for , then
(3) |
Formally, we have
(4) |
For , we always have
(5) |
where is the lower tail quantile for the lower tail probability . Therefore,
(6) |
which implies that solving the lower or upper tail probability is equivalent to solve the inverse of the CDF. Unfortunately, there is no simple expression for and it is difficult to calculate the inverse .
Moreover, for sufficiently large , the statistic will approach to , which implies that the curve of will become more and more steep with the increasing of and
(7) |
Although the Kuiper’s test has been proposed for about 50 years, it is not widely known to college students, computer programmers, engineers, experimental psychologist and so on partly due to the difficulty of solving the upper tail quantile and partly due to the lack of open software for automatic calculation. Let
(8) |
be the Kuiper’s statistic of critical value for the -test, Kuiper [1, 11] pointed out that
(9) |
for the positive critical value . It should be noted that the upper bound for the approximation error is , which implies this formula is appropriate for large sample capacity . Kuiper’ s approximation
(10) |
for solving is based on the terms in which of the two infinite series in (9). There are some disadvantages for this approximation:
-
•
the terms in which in the two infinite series have been ignored, which not only reduces the numerical precision of the solution due to the term for small but also reduces the feasible region for the initial value of , denoted by , in numerical computation;
-
•
the condition is not appropriate and smaller lower bound for is allowed.
Stephens [2] proposed the modified statistic for the replacement of , but his approximation
(11) |
is based on the first term of the first infinite series in (12). Obviously, this approximation does not depend on the parameter and its precision will be affected significantly. In other words, this approximation just works well for sufficiently large , which means that the number of random samples should be large enough in the sense of data analysis. Furthermore, Kuiper discussed the -test but Stephens ignored it. It is a common dark side of both Kuiper’s work and Stephens’s work that there are lack of numerical algorithms for solving the numerical solution to the critical value for the given upper tail probability in the era of 1960s and 1970s when only a few people can use computers and the computer science was not fully developed.
It is easy to find that the two infinite sequences in (9) converge rapidly and it is a better approximation if we consider the first two terms when compared with the schemes taken by Kuiper and Stephens. By taking the first two terms for the infinite series, we can deduce that
(12) | ||||
This approximation is a second order approximation for infinite series about the index , which is more reasonable due to the term in (12).
In this paper, our emphasis is put on the numerical algorithms for automatic approaches for solving the upper tail critical value and quantile of Kuiper’s statistic. The contents of this paper are organized as follows: Section 2 gives the preliminaries about the principle and algorithm for fixed-point equation; Section 3 focuses on the computational method for solving Kuiper’s pairs of -test and -test; Section 4 presents the algorithms with pseudo-code; Section 5 demonstrates the numerical results which is comparable with Kuiper’s original results; Section 6 discussed the impact of the choices of nonlinear equation and initial value on the numerical solution; and finally Section 7 is the conclusion.
2 Preliminaries
2.1 Principle of Iterative Method for Fixed-Point
Although there are various fixed-point theorems [12, 13] for different situation and applications, we just consider the fixed-point iterative method for solving nonlinear equations according to our objective of solving Kuiper’s pairs and .
For a nonlinear equation
(13) |
usually we can convert it into a fixed-point equation equivalently
(14) |
where is a mapping and is a contractive operator. There are two typical categories of fixed-point equation:
-
(i)
Direct iterative scheme
(15) which depends on the function .
-
(ii)
Newton’s iterative scheme
(16) which depends not only on the equivalent nonlinear mapping from
(17) but also on its derivative .
We remark that the strings ”ctm” and ”nlm” in the subscripts means contractive mapping and nonlinear mapping respectively.
The initial value, say , should be set carefully since there is a domain for the contractive mapping generally. For mathematicians, it is necessary to prove the feasibility of choice . For engineers and computer programmers, they may prefer to draw the curve of for and observe the interval for of the root to set the initial value , which is more intuitive and efficient than rigorous mathematical analysis.
The stopping condition for the iterative method is satisfied by the Cauchy’s criteria for the convergent sequence
(18) |
where denotes the precision and is a metric for the difference of the current value of , say and its updated version, say . The simplest choice of is the absolute value function for , i.e.,
(19) |
For practical problems arising in various fields, there may be some extra parameters in the function , say where is a real number, is an integer, where the order of is not important222In other words, both and are feasible and correct for computer programming.. In general, we can use the notations and to represent the scenario when there are some extra parameters. We remark that the derivative of with respect to the variable should be calculated by
(20) |
for the Newton’s iterative method.
It should be remarked the abstraction level is essential for designing feasible algorithm to solve the fixed-point of the form
(21) |
for the contractive mapping or its equivalent form , which is called the updating function in programming language. Note that the extra parameters are moved to upper subscript and subscript such that in order to emphasize the key variable and function . In the sense of functional analysis, the or in (21) is an abstract function. By comparison, in the sense of programming language in computer science, the or is a high order function and is a function object which is called a pointer to function in C/C++98, or a -expression in Lisp/Haskell/Julia/Python/C++11/Java, or function handle in Octave/MATLAB, and so on.
2.2 Unified Framework and Algorithm for Solving Fixed-point
We now give the pseudo-code for the fixed-point algorithms with the concepts of high order function and function object, please see Algorithm 2.2. Note that the order for the list of arguments can be set according to the programmer’s preferences. If a default value for the should be configured, it is wise to set the as the last formal argument for the convenience of implementation with some concrete computer programming language such as the C++.
Algorithm 1 Unified Framework for Solving the Fixed-Point of
In the sense of programming language and discrete mathematics, is an ordinary (first order) function, is a second order function and FixedPointSolve is a third order function.
Algorithm 2 Calculate the distance of and
3 Computational Method of Critical Value and Quantile for Kuiper’s Test
In this paper, our key issue here is to design algorithm to compute the for the given upper tail quantile and the integer .
3.1 Computation of Kuiper’s Critical Value in -test
Put
(22) |
and substitute (22) into (12), we can obtain the key equation for specifying the critical value for the given and as follows
(23) |
Let
(24) |
where the digit 1 in the string ”nlm1” means single for the notation , then the critical value is the solution of the following non-linear equation
(25) |
where is a concrete version of with two extra parameters and . There are various methods for solving non-linear equation (25) and our method is based on the fixed-point theorem [12] and iterative algorithm.
A necessary condition for (12) is that for any . Let , we immediately have
(26) |
Thus, we get the following necessary condition
(27) |
for the function . Kuiper [1] pointed out that a necessary condition for is when the first term is considered in the infinite series for (12). On the other hand, the larger the is, the larger is feasible according to the definition of critical value in the sense of large samples in statistics. Hence for fixed and , we can find that gives the upper bound of the variable . For , we can find that .
3.1.1 Direct Iterative Method
Let
(28) |
then (23) implies that
(29) |
It is easy to verify that is a contractive mapping for the given positive integer and upper tail probability for appropriate domain of , say . Consequently, the fixed-point theorem implies that the iterative formula
(30) |
must converge if the initial value .




Figure 1 demonstrates the intersection of and clearly. It is easy to find that the absolute value of the derivative (and it is small enough) for such that is a good contractive mapping. For and , there are two intersection points for the line and the curve , and the solutions are discarded. For and , there is just one intersection point for the line and the curve , and the feasible solution is larger than . It is obvious that for the fixed , the smaller the is, the larger the is.
3.1.2 Newton’s Iterative Method
The Newton’s iterative formula for Kuiper’s -test can be written by
(31) |
where
(32) |
is the Newton’s updating function. The mapping is a contractive mapping for appropriate domain of , say . The initial value for the Newton’s iterative method could be set by .




Figure 2 shows the curve of for and fixed and . It should be noted that the necessary condition automatically rejects the possible root which lies in the open interval . Although the diagram in Figure 2 is different its counterpart in Figure 1, the solution obtained with the Newton’s iterative method via is the same as that obtained by the direct iterative method via .
3.1.3 Kuiper’s Pair for Kuiper’s -test
With the help of the two contractive mappings and , the fixed-point for the equation (23) can be solved with the direct iterative method or Newton’s iterative method, which is the critical value such that . The relation of the critical value and upper tail probability can be expressed by
(33) |
since we have
(34) |
by the definitions of critical value and upper tail probability. Once the critical value is obtained, the computation of upper tail quantile can be solved according to (33). This completes the computation of the Kuiper’s pair with the fixed-point method.
3.2 Computation of the Pairs for Kuiper’s -Test
For the Kuiper’s -test, there is also a formula for the upper tail probability [1, 14]
(35) |
We can approximate the infinite series with the first and second term as done for the -test, which implies that
(36) | ||||
Let
(37) |
then we can deduce that
(38) |
Let
(39) |
where the digit in the subscript ”nlm2” denotes the double in and
(40) |
We also can construct two iterative formulas for solving the nonlinear equation
(41) |
to solve the as follows:
-
•
Newton’s iterative method:
(42) -
•
direct iterative method:
(43)
Just like the process of solving , the defined by
(44) |
is the limit of the sequence generated by and . The initial value for solving can be observed from the figure of with the variable intuitively. It should be noted that there is no modified version of the -test due to the error bound for the approximation in (35) is instead of .








4 Fixed-Point Algorithms for Solving the Pair of Kuiper’s Test
4.1 Auxiliary Procedures
In order to reduce the structure complexity of our key algorithms for solving the Kuiper’s pair , it is wise to introduce some auxiliary procedures. The procedures FunA1cn and FunA2cn in Algorithm 4.1 and Algorithm 4.1 are designed for computing and respectively.
Algorithm 3 Calculating the value of arising in the updating function in -test
Algorithm 4 Calculating the value of arising in the -test
The procedures FunFnlm1 and FunFnlm2 in Algorithm 4.1 and Algorithm 4.1 are designed for computing the non-linear functions for the -test and for the -test respectively.
Algorithm 5 Calculating the value of for the updating function in -test
Algorithm 6 Calculating the value of for the updating function in -test
The procedures FunFctm1 and FunFctm2 in Algorithm 4.1 and Algorithm 4.1 are designed for computing the non-linear functions for the -test and for the -test respectively.
Algorithm 7 Calculating the for the updating operator in -test
Algorithm 8 Calculating the for the updating operator in -test
4.2 Updating Mapping
The updating mapping is essential for the iterative scheme for solving the fixed-point. The high order procedure UpdateMethodDirect in Algorithm 4.2 is designed for computing the contractive mapping for the -test and for the -test with a unified interface for the direct iterative method.
Algorithm 9 Calculating the Contractive Mapping and
-
•
if , then we get in -test and
-
•
if , then we get in -test.
Similarly, The high order procedure UpdateMethodNewton in Algorithm 4.2 is designed for computing the contractive mapping for the -test and for the -test with a unified interface for the Newton iterative method.
Algorithm 10 Calculating the Newton’s updating functions and
-
•
if , then we get in -test and
-
•
if , then we get in -test.
4.3 Algorithms for Solving the Kuiper Pair for -test and -test
It is significant for us to calculate the original Kuiper pair for Kuiper’s -test where . The procedure KuiperPairSolver listed in Algorithm 4.3 provides a unified framework for solving the Kuiper pair with the Direct or Newton’s iterative method.
Algorithm 11 Fixed-point iterative algorithm for solving the Kuiper’s pair in -test or in -test with the while-do loop and direct/Newton iterative method
4.4 Algorithms for Solving the Upper/Lower Tail Quantile and Inverse of CDF
For most applications, we may have no interest in the critical value and our emphasis is put on the upper/lower tail quantile in -test. Moreover, it is enough to choose the Newton’s iterative method in order to find the upper/lower tail quantile. In Algorithm 4.4, the procedure KuiperUTQ is designed to solve the upper tail quantile. We remark that in the implementation of KuiperUTQ, the procedure FixedPointSolver is used instead of KuiperPairSolver.
Algorithm 12 Computing the upper tail quantile in Kuiper’s -test
The lower tail quantile may become more attractive for some applications. The procedure KuiperLTQ listed in Algorithm 4.4 is based on the procedures KuiperPairSolver. An alternative implementation of KuiperLTQ can be done with the equivalence of . In other words, we have for any .
Algorithm 13 Compute the Lower Tail Quantile in Kuiper’s -test
For the applications of goodness-of-fit test where Kuiper’s -test is involved, it is the inverse of the CDF of that must be solved according to (4) or (6). It is easy to find that
(45) |
by the definitions of lower tail probability and CDF. Therefore, the inverse of CDF can be obtained by the calling the procedure KuiperLTQ or KuiperUTQ directly with proper argument. The procedure KuiperInvCDF in Algorithm 4.4 is designed for computing the for any probability .
Algorithm 14 Compute the inverse CDF for Kuiper’s -test
5 Verification and Validation
5.1 An Error in Kuiper’s Numerical Results
For the configuration of and , the Kuiper pair for Kuiper’s -test can be computed by the algorithms above and code released on the GitHub by the authors. Table 2 lists some typical results for the pair . Our results coincide with Kuiper’s numerical results very well and the readers can check the values in Table 2 and their counterparts in Table 1. It should be noted that extra values for are added in the table. Moreover, the readers can get more effective digits with our code released on the GitHub.
It should be noted that there is an error in Kuiper’s table for . The comparison of Table 2 and Table 1 shows that the value by Kuiper is wrong with the help of our code released on GitHub. Obviously, the correct value should be by our algorithms and code or according to Kuiper’s approximation in which only the term is considered for the infinite series. We deem that this error might be a typo due to the manual work on editing the data since in the 1960 era it is difficult for a researcher to find an automatic tool for processing data.
5.2 Table of Kuiper pair of -test for
Kuiper [1] also presented a table of for and . Our programs also give similar numerical results, as shown in Table 3.
Critical value | Upper Tail Quantile | Upper tail probability |
---|---|---|
5.3 Special case of Sufficiently Large Number of Samples
If the number of samples is large enough, we can let approach to infinity. Therefore,
(46) |
The Kuiper’s critical value is the fixed-point of
(47) |
We start the iterative procedure with initial value and set , and provide the for typical values of in Table 4, which also coincides with Kuiper’s original results for very well but our results illustrate more possible values of .
5.4 Kuiper pair for Kuiper’s -test
Table 5 demonstrates the Kuiper pair for and with the help of the procedure KuiperPairSolver in Algorithm 4.3. We remark that the corresponding values for proposed by Kuiper [1] is and the values of is not listed.
5.5 Cumulative Distribution Function for Kuiper’s -test
With the help of (6) and Algorithm 4.4, we can compute the by calling the procedure KuiperInvCDF as follows
(48) |
Thus for each capacity of the random samples and probability sequence
we can draw the curve of CDF with the pairs such that .
Figure 5 illustrates the CDF of statistic for various sample capacity . It is obvious that with the increasing of , the curve of CDF becomes more and more steep, which coincides with (7). Moreover, the horizontal line shows the upper tail probability . The intersection points of the line with the CDF are the upper tail quantile for where .

We remark that there are three equivalent ways for computing the inverse of CDF. Actually, we have
(49) | ||||
for ant .
6 Discussion
6.1 An Alternative Choice of Non-linear Function for -test
The disadvantage of Newton’s iterative method for solving root lies in two aspects: firstly, derivative of the objective function is required and the method will fail if the derivative is near to 0. Actually, if we take the following alternative equivalent nonlinear equation for
(50) |
then for the fixed and the function will have a flat region where the derivative will be near zero, thus the Newton’s iterative method may fail if the initial value is larger than the root. Figure 6 demonstrates this situation clearly in which for the curve of is very flat.

6.2 Choices of Initial Value for the Critical Value
Theoretical and numerical experiments indicate the way for setting the initial value for solving the Kuiper pair. Our suggestions are listed as follows:
-
•
for the -test, we can set: for the direct iterative method based on and for the Newton’s iterative method based on ;
-
•
fort the -test, we can set: for the direct iterative method based on and for the Newton’s iterative method based on .
In summary, if we set , then the algorithms proposed could work well for both -test and -test.
6.3 Limitation of Kuiper’s First Order Approximation for the Cumulative Distribution Function
The limitation of Kuiper’s first order approximation for the cumulative distribution function is that the approximation error is bounded by . Thus for small , the numerical precision is not high. Although Stephens [2] proposed the modified statistic for replacing the for small , the bound of approximation error is not discussed. Essentially, what we need is a more precise formula for (9) with smaller approximation error, say or , instead of using directly without verification and validation.
7 Conclusion
The computation of the critical value and upper tail quantile, Kuiper pair for simplification, is equivalent to solve the fixed-point of the nonlinear equation which involves two infinite series by iterative method for Kuiper’s statistic or . The Kuiper’s pair can be solved with the following steps:
-
(1)
simplifying the nonlinear equation with second order approximation for in the asymptotic expansion;
-
(2)
converting the nonlinear equation to a fixed-point equation with the form by setting the updating operator , the function object and initial value properly via the direct iterative scheme or the Newton’s scheme ;
-
(3)
designing algorithms for solving the fixed-point equation in order to compute the critical value and the upper tail quantile ;
For the convenience of implementation with concrete computer programming languages such as C, C++, Python, Octave, MATLAB and so on, the pseudo-code for the algorithms are provided with details. There are some advantages for our methods and algorithms:
-
(1)
a unified theoretic framework for solving fixed-point, based on the concept of functional in mathematics and the high order function in computer science, is discussed in detail by combining the merits of mathematics and computer science, which is general and elastic enough for solving lots of fixed-point problems arising in science, technology, engineering and mathematics;
-
(2)
a unified interface is set for solving the Kuiper’s pairs in the -test and -test;
-
(3)
procedures for solving the upper/lower tail quantile are provided for the potential applications of the Kuiper’s statistic in the goodness-of-fit test;
-
(4)
the computational complexity is linear since there is no nested loops in the algorithm, and the reader can test the running time with the help of the C code released on GitHub;
-
(5)
the methods proposed in this paper can be modified slightly to solve the Kolmogrov-Smirmov test, -test and normal test since the difference behind these different tests lies in the concrete form of the nonlinear equation for the given upper tail significance level and the CDF encountered for the population and random samples .
Our verification and validation shows that there is a mistake in Kuiper’s table of critical value for . The correct value for should be or instead of . It might be a typo introduced by manual work on editing the data in the 1960 era.
In the sense of STEM education, the topic of this paper can be used as a comprehensive project for training the college students’ ability of solving complex problems by combining the mathematics and computer programming.
Acknowledgements
This work was supported in part by the Hainan Provincial Natural Science Foundation of China under grant numbers 720RC616 and 2019RC199, and in part by the National Natural Science Foundation of China under grant number 62167003.
Code availability statement
The code for the implementations of the algorithms discussed in this paper can be downloaded from the following GitHub website: https://github.com/GrAbsRD/KuiperVnStatistic.
References
- [1] Nicolas H. Kuiper. Tests concerning random points on a circle. In Proceedings of the Koninklijke Nederlandse Akademie van Wetenschappen, volume 63 of A: Mathemaical Statistics, pages 38–47, 1960. Available online: https://core.ac.uk/download/pdf/82631793.pdf.
- [2] M. A. Stephens. Use of the Kolmogorov-Smirnov, Cramer-Von mises and related statistics without extensive tables. Journal of the Royal Statistical Society, Series B (Methodological), 32(1):115–122, 1970.
- [3] E. S. Pearson and H. O. Hartley, editors. Biometrika Tables for Statisticians, volume 2. Cambridge University Press, 1972.
- [4] Yadolah Dodge. The Concise Encyclopedia of Statistics, pages 283–287. Springer New York, New York, 2008. https://doi.org/10.1007/978-0-387-32833-1_214.
- [5] Donald E. Knuth. The Art of Computer Programming: Vol.2 Seminumerical Algorithms. Addison-Wesley Professional, New York, 1997.
- [6] Xiaohang Jin, Tommy W. S. Chow, Yi Sun, Jihong Shan, and Bill C. P. Lau. Kuiper test and autoregressive model-based approach for wireless sensor network fault diagnosis. Wireless Netwwork, 21(9):829–839, 2015. https://doi.org/10.1007/s11276-014-0820-0.
- [7] W. H. Press, B. P. Flannery, S. A. Teukolsky, and W. T. Vetterling. Numerical Recipes in C++: The Art of Scientific Computing, pages 625–633. Addison-Wesley Professional, Cambridge University Press, 2nd edition, 2002.
- [8] Christoffer Koch and Ken Okamura. Benford’s Law and COVID-19 reporting. Economics Letters, 196(11):1/109573–4/109573, 2020. https://doi.org/10.1016/j.econlet.2020.109573.
- [9] Connor Dowd. A New ECDF Two-Sample Test Statistic, 2007. arxiv: 2007.01360 [stat], http://arxiv.org/abs/2007.01360.
- [10] John R. Lanzante. Testing for differences between two distributions in the presence of serial correlation using the Kolmogorov–Smirnov and Kuiper’s tests. International Journal of Climatology, 41(14):6314–6323, 2021. https://onlinelibrary.wiley.com/doi/10.1002/joc.7196.
- [11] D. A. Darling. The Kolmogorov-Smirnov, Cramer-von Mises Tests. The Annals of Mathematical Statistics, 28(4):823–838, 1957. http://www.jstor.org/stable/2237048, published by Institute of Mathematical Statistics.
- [12] Eberhard Zeidler. Applied Functional Analysis: Applications to Mathematical Physics, Vol. 1, volume 108 of Applied Mathemaical Sciences. Springer, New York, 3rd edition, 1995.
- [13] Kendall Atkinson and Weimin Han. Theoretical Numerical Analysis: A Functional Analysis Framework, volume 39 of Texts in Applied Mathematics. Springer, New York, 3rd edition, 2009.
- [14] J. H. B. Kemperman. Asymptotic expansions for the Smirnov test and for the range of cumulative sums. The Annals of Mathematical Statistics, 30(2):448–462, Jun. 1959. https://www.jstor.org/stable/2237092.