This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Fixed-Point Algorithm for Solving the Critical Value and Upper Tail Quantile of Kuiper’s Statistics

Hong-Yan Zhang, Wei Sun, Xiao Chen, Rui-Jia Lin and Yu Zhou

School of Information Science and Technology, Hainan Normal University, Haikou 571158, China
Corresponding author: Hong-Yan Zhang; email: hongyan@hainnu.edu.cn; ORCID: 0000-0002-4400-9133
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 cnαc^{\alpha}_{n} for (α,n)=(0.01,30)(\alpha,n)=(0.01,30) in Kuiper’s distribution table has been labeled and corrected where nn is the sample capacity and α\alpha 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) F1(x)F_{1}(x) and F2(x)F_{2}(x), Kuiper’s test [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] is defined by

V=D++D=supx[F1(x)F2(x)]+supx[F2(x)F1(x)]V=D^{+}+D^{-}=\sup_{x}[F_{1}(x)-F_{2}(x)]+\sup_{x}[F_{2}(x)-F_{1}(x)] (1)

where the discrepancy statistics

D+=supx[F1(x)F2(x)],D=supx[F2(x)F1(x)]=infx[F1(x)F2(x)]D^{+}=\sup_{x\in\mathbb{R}}[F_{1}(x)-F_{2}(x)],\quad D^{-}=\sup_{x\in\mathbb{R}}[F_{2}(x)-F_{1}(x)]=-\inf_{x\in\mathbb{R}}[F_{1}(x)-F_{2}(x)] (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 D++DD^{+}+D^{-} as the test statistic instead of supx|F1(x)F2(x)|\displaystyle\sup_{x}\left|F_{1}(x)-F_{2}(x)\right| 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]

  • VnV_{n}-test, which is used for comparing two distributions with nn samples;

  • Vn,mV_{n,m}-test, which is used for comparing two distributions with nn and mm samples respectively.

Suppose that FVn(x)F_{V_{n}}(x) is the CDF of the Kuiper’s statistic VnV_{n}, α\alpha 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 vnαv^{\alpha}_{n} is the upper tail quantile (UTQ, also named upper tail fractile) for VnV_{n}, then

α=Pr{Vn>vnα}=1Pr{Vnvnα}=1FVn(vnα).\alpha=\Pr\left\{V_{n}>v^{\alpha}_{n}\right\}=1-\Pr\left\{V_{n}\leq v^{\alpha}_{n}\right\}=1-F_{V_{n}}(v^{\alpha}_{n}). (3)

Formally, we have

vnα=FVn1(1α).v^{\alpha}_{n}=F^{-1}_{V_{n}}(1-\alpha). (4)

For α[0,1]\forall\alpha\in[0,1], we always have

v1αn=vnαv_{1-\alpha}^{n}=v^{\alpha}_{n} (5)

where v1αnv_{1-\alpha}^{n} is the lower tail quantile for the lower tail probability 1α1-\alpha. Therefore,

vαn=vn1α=FVn1(α),α[0,1],v_{\alpha}^{n}=v^{1-\alpha}_{n}=F^{-1}_{V_{n}}(\alpha),\quad\forall\alpha\in[0,1], (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 FVn()F_{V_{n}}(\cdot) and it is difficult to calculate the inverse FVn1()F^{-1}_{V_{n}}(\cdot).

Moreover, for sufficiently large nn, the statistic Vn=Dn++DnV_{n}=D^{+}_{n}+D^{-}_{n} will approach to 0, which implies that the curve of FVn(x)F_{V_{n}}(x) will become more and more steep with the increasing of nn and

limnFVn(x)={1,x0;0,x<0.\lim_{n\to\infty}F_{V_{n}}(x)=\left\{\begin{aligned} 1,&&x\geq 0;\\ 0,&&x<0.\end{aligned}\right. (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

Kn=nVn=n(Dn++Dn)K_{n}=\sqrt{n}\cdot V_{n}=\sqrt{n}\cdot(D^{+}_{n}+D^{-}_{n}) (8)

be the Kuiper’s KnK_{n} statistic of critical value for the VnV_{n}-test, Kuiper [1, 11] pointed out that

Pr{Knc}=1j=12(4j2c21)e2j2c2+83ncj=1j2(4j2c23)e2j2c2+𝒪(1n),\displaystyle\Pr\left\{K_{n}\leq c\right\}=1-\sum^{\infty}_{j=1}2(4j^{2}c^{2}-1)\mathrm{e}^{-2j^{2}c^{2}}+\frac{8}{3\sqrt{n}}c\sum^{\infty}_{j=1}j^{2}(4j^{2}c^{2}-3)\mathrm{e}^{-2j^{2}c^{2}}+\mathcal{O}\left(\frac{1}{n}\right), (9)

for the positive critical value cc. It should be noted that the upper bound for the approximation error is 𝒪(n1)\mathcal{O}\left(n^{-1}\right), which implies this formula is appropriate for large sample capacity nn. Kuiper’ s approximation

α=Pr{Kn>c}[2+8nc+8c2323nc3]e2c2,c>65,\alpha=\Pr\left\{K_{n}>c\right\}\approx\left[-2+\frac{8}{\sqrt{n}}c+8c^{2}-\frac{32}{3\sqrt{n}}c^{3}\right]\mathrm{e}^{-2c^{2}},\quad c>\frac{6}{5}, (10)

for solving cc is based on the terms in which j=1j=1 of the two infinite series in (9). There are some disadvantages for this approximation:

  • the terms in which j=2j=2 in the two infinite series have been ignored, which not only reduces the numerical precision of the solution cc due to the term 𝒪(n1)\mathcal{O}\left(n^{-1}\right) for small nn but also reduces the feasible region for the initial value of cc, denoted by cguess{c}_{\mathrm{guess}}, in numerical computation;

  • the condition c>6/5c>6/5 is not appropriate and smaller lower bound for cc is allowed.

Stephens [2] proposed the modified statistic for the replacement of VnV_{n}, but his approximation

α=(8c22)e2c2,\alpha=(8c^{2}-2)\mathrm{e}^{-2c^{2}}, (11)

is based on the first term of the first infinite series in (12). Obviously, this approximation does not depend on the parameter nn and its precision will be affected significantly. In other words, this approximation just works well for sufficiently large nn, which means that the number of random samples should be large enough in the sense of data analysis. Furthermore, Kuiper discussed the Vn,nV_{n,n}-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 cc for the given upper tail probability α\alpha 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

α\displaystyle\alpha =Pr{Kn>c}=j=12(4j2c21)e2j2c283ncj=1j2(4j2c23)e2j2c2+𝒪(1n)\displaystyle=\Pr\left\{K_{n}>c\right\}=\sum^{\infty}_{j=1}2(4j^{2}c^{2}-1)\mathrm{e}^{-2j^{2}c^{2}}-\frac{8}{3\sqrt{n}}c\sum^{\infty}_{j=1}j^{2}(4j^{2}c^{2}-3)\mathrm{e}^{-2j^{2}c^{2}}+\mathcal{O}\left(\frac{1}{n}\right) (12)
[2(4c21)83nc(4c23)]e2c2+[2(16c21)323nc(16c23)]e8c2\displaystyle\approx\left[2(4c^{2}-1)-\frac{8}{3\sqrt{n}}c(4c^{2}-3)\right]\mathrm{e}^{-2c^{2}}+\left[2(16c^{2}-1)-\frac{32}{3\sqrt{n}}c(16c^{2}-3)\right]\mathrm{e}^{-8c^{2}}
=[2+8nc+8c2323nc3]e2c2+[2+32nc+32c25123nc3]e8c2.\displaystyle=\left[-2+\frac{8}{\sqrt{n}}c+8c^{2}-\frac{32}{3\sqrt{n}}c^{3}\right]\mathrm{e}^{-2c^{2}}+\left[-2+\frac{32}{\sqrt{n}}c+32c^{2}-\frac{512}{3\sqrt{n}}c^{3}\right]\mathrm{e}^{-8c^{2}}.

This approximation is a second order approximation for infinite series about the index jj, which is more reasonable due to the term 𝒪(n1)\mathcal{O}\left(n^{-1}\right) 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 VnV_{n}-test and Vn,nV_{n,n}-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 cnα,vnα\left\langle{c^{\alpha}_{n}},{v^{\alpha}_{n}}\right\rangle and cn,nα,vn,nα\left\langle{c^{\alpha}_{n,n}},{v^{\alpha}_{n,n}}\right\rangle.

For a nonlinear equation

f(x)=0,x[a,b]f(x)=0,\quad x\in[a,b] (13)

usually we can convert it into a fixed-point equation equivalently

x=T(f,x),x[a,b]x=T(f,x),\quad x\in[a,b] (14)

where f()f(\cdot) is a mapping and T(,)T(\cdot,\cdot) is a contractive operator. There are two typical categories of fixed-point equation:

  • (i)

    Direct iterative scheme

    xi+1=T(fctm(xi),xi)=fctm(xi)x_{i+1}=T({f}_{\mathrm{ctm}}(x_{i}),x_{i})={f}_{\mathrm{ctm}}(x_{i}) (15)

    which depends on the function fctm{f}_{\mathrm{ctm}}.

  • (ii)

    Newton’s iterative scheme

    xi+1=T(fnlm(xi),xi)=xifnlm(xi)fnlm(xi),x_{i+1}=T({f}_{\mathrm{nlm}}(x_{i}),x_{i})=x_{i}-\frac{{f}_{\mathrm{nlm}}(x_{i})}{{f}_{\mathrm{nlm}}^{\prime}(x_{i})}, (16)

    which depends not only on the equivalent nonlinear mapping fnlm(x){f}_{\mathrm{nlm}}(x) from

    ϕ(x)=0fnlm(x)=0\phi(x)=0\Longleftrightarrow{f}_{\mathrm{nlm}}(x)=0 (17)

    but also on its derivative fnlm(x){f}_{\mathrm{nlm}}^{\prime}(x).

We remark that the strings ”ctm” and ”nlm” in the subscripts means contractive mapping and nonlinear mapping respectively.

The initial value, say xguess{x}_{\mathrm{guess}}, should be set carefully since there is a domain for the contractive mapping TT generally. For mathematicians, it is necessary to prove the feasibility of choice xguess{x}_{\mathrm{guess}}. For engineers and computer programmers, they may prefer to draw the curve of y=xT(f,x)y=x-T(f,x) for x[a,b]x\in[a,b] and observe the interval for of the root to set the initial value xguess{x}_{\mathrm{guess}}, 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 {xi:i=0,1,2,3,}\left\{x_{i}:i=0,1,2,3,\cdots\right\}

d(xi+1,xi)<ϵd(x_{i+1},x_{i})<\epsilon (18)

where ϵ\epsilon denotes the precision and d(,)d(\cdot,\cdot) is a metric for the difference of the current value of xx, say xguess{x}_{\mathrm{guess}} and its updated version, say ximprove{x}_{\mathrm{improve}}. The simplest choice of d(,)d(\cdot,\cdot) is the absolute value function for x[a,b]x\in[a,b]\in\mathbb{R}, i.e.,

d(xi,xi+1)=d(xi+1,xi)=|xi+1xi|d(x_{i},x_{i+1})=d(x_{i+1},x_{i})=\left|x_{i+1}-x_{i}\right| (19)

For practical problems arising in various fields, there may be some extra parameters in the function ϕ\phi, say ϕ(x,α,n)\phi(x,\alpha,n) where α\alpha is a real number, nn is an integer, where the order of x,α,nx,\alpha,n is not important222In other words, both ϕ(x,α,n)\phi(x,\alpha,n) and ϕ(x,n,α)\phi(x,n,\alpha) are feasible and correct for computer programming.. In general, we can use the notations ϕ(x,μ1,,μr),f(x,μ1μr)\phi(x,\mu_{1},\cdots,\mu_{r}),f(x,\mu_{1}\cdots\mu_{r}) and T(f,x,μ1,,μr)T(f,x,\mu_{1},\cdots,\mu_{r}) to represent the scenario when there are some extra parameters. We remark that the derivative of f(x,μ1,,mr)f(x,\mu_{1},\cdots,m_{r}) with respect to the variable xx should be calculated by

f(x,μ1,μr)=limΔx0f(x+Δx,μ1,,μr)f(x,μ1,,μr)Δxf^{\prime}(x,\mu_{1},\cdots\mu_{r})=\lim_{\Delta x\to 0}\frac{f(x+\Delta x,\mu_{1},\cdots,\mu_{r})-f(x,\mu_{1},\cdots,\mu_{r})}{\Delta x} (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

x=T(f,x,μ1,,μr)=𝒯(f,x),x[a,b]x=T(f,x,\mu_{1},\cdots,\mu_{r})=\mathcal{T}^{*}_{\star}(f,x),\quad x\in[a,b] (21)

for the contractive mapping TT or its equivalent form 𝒯\mathcal{T}^{*}_{\star}, which is called the updating function in programming language. Note that the extra parameters μ1,,μr\mu_{1},\cdots,\mu_{r} are moved to upper subscript * and subscript \star such that (,)=(μ1,,μr)(*,\star)=(\mu_{1},\cdots,\mu_{r}) in order to emphasize the key variable xx and function ff. In the sense of functional analysis, the TT or 𝒯\mathcal{T}^{*}_{\star} in (21) is an abstract function. By comparison, in the sense of programming language in computer science, the TT or 𝒯\mathcal{T}^{*}_{\star} is a high order function and ff is a function object which is called a pointer to function in C/C++98, or a λ\lambda-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 xguess{x}_{\mathrm{guess}} should be configured, it is wise to set the xguess{x}_{\mathrm{guess}} 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 x=𝒯(f,x)=T(f,x,μ1,,μr)x=\mathcal{T}^{*}_{\star}(f,x)=T(f,x,\mu_{1},\cdots,\mu_{r})

 
1:Contractive mapping TT as the updator which is a high order function, function object ff for the fnlm{f}_{\mathrm{nlm}} or fctm{f}_{\mathrm{ctm}}, function object dd for the distance d(xi,xi+1)d(x_{i},x_{i+1}), precision ϵ\epsilon, initial value xguess{x}_{\mathrm{guess}} and extra parameters μ1,,μr\mu_{1},\cdots,\mu_{r} with the same or different data types.
2:Fixed-point xx such that x=𝒯(f,x)=T(f,x,μ1,,μr)x=\mathcal{T}^{*}_{\star}(f,x)=T(f,x,\mu_{1},\cdots,\mu_{r})
3:function FixedPointSolver(T,f,d,ϵ,xguess,μ1,,μrT,f,d,\epsilon,{x}_{\mathrm{guess}},\mu_{1},\cdots,\mu_{r})
4:  ximproveT(f,xguess,μ1,,μr){x}_{\mathrm{improve}}\leftarrow T(f,{x}_{\mathrm{guess}},\mu_{1},\cdots,\mu_{r});
5:  while d(ximprove,xguess)ϵd({x}_{\mathrm{improve}},{x}_{\mathrm{guess}})\geq\epsilon do
6:   xguessximprove{x}_{\mathrm{guess}}\leftarrow{x}_{\mathrm{improve}};
7:   ximproveT(f,xguess,μ1,,μr){x}_{\mathrm{improve}}\leftarrow T(f,{x}_{\mathrm{guess}},\mu_{1},\cdots,\mu_{r});
8:  end while
9:  return ximprove{x}_{\mathrm{improve}};
10:end function
 

In the sense of programming language and discrete mathematics, ff is an ordinary (first order) function, TT is a second order function and FixedPointSolve is a third order function.

 

Algorithm 2 Calculate the distance of xx and yy

 
1:x,yx,y\in\mathbb{R}
2:The distance of xx and yy, i.e., d(x,y)d(x,y)
3:function Distance(x,yx,y)
4:  dist|xy|\texttt{dist}\leftarrow\left|x-y\right|;  // if x,yn×1x,y\in\mathbb{R}^{{n}\times{1}}, we can use the p\ell^{p}-norm to get the distance by xyp{\left\lVert x-y\right\rVert}_{p}
5:  return dist;
6:end function
 

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 FVn1(1α)F^{-1}_{V_{n}}(1-\alpha) for the given upper tail quantile α\alpha and the integer nn.

3.1 Computation of Kuiper’s Critical Value in VnV_{n}-test

Put

A1(c,n)=2+8nc+8c2323nc3,A2(c,n)=2+32nc+32c25123nc3A_{1}(c,n)=-2+\frac{8}{\sqrt{n}}c+8c^{2}-\frac{32}{3\sqrt{n}}c^{3},\quad A_{2}(c,n)=-2+\frac{32}{\sqrt{n}}c+32c^{2}-\frac{512}{3\sqrt{n}}c^{3} (22)

and substitute (22) into (12), we can obtain the key equation for specifying the critical value cc for the given α\alpha and nn as follows

2c2+lnα=ln[A1(c,n)+A2(c,n)e6c2].\boxed{2c^{2}+\ln\alpha=\ln\left[A_{1}(c,n)+A_{2}(c,n)\cdot\mathrm{e}^{-6c^{2}}\right]}. (23)

Let

fnlm1(c,α,n)=2c2+lnαln[A1(c,n)+A2(c,n)e6c2],{f}_{\mathrm{nlm1}}(c,\alpha,n)=2c^{2}+\ln\alpha-\ln\left[A_{1}(c,n)+A_{2}(c,n)\cdot\mathrm{e}^{-6c^{2}}\right], (24)

where the digit 1 in the string ”nlm1” means single nn for the notation VnV_{n}, then the critical value cαc_{\alpha} is the solution of the following non-linear equation

fnlm1(c,α,n)=0{f}_{\mathrm{nlm1}}(c,\alpha,n)=0 (25)

where fnlm1{f}_{\mathrm{nlm1}} is a concrete version of ϕ(x,μ1,,μr)=0\phi(x,\mu_{1},\cdots,\mu_{r})=0 with two extra parameters μ1=α\mu_{1}=\alpha and μ2=n\mu_{2}=n. 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 α=Pr{nVn>c}>0\alpha=\Pr\left\{\sqrt{n}\cdot V_{n}>c\right\}>0 for any nn\in\mathbb{N}. Let nn\to\infty, we immediately have

A1(,c)=2+8c2>0,A2(,c)=2+32c2>0.A_{1}(\infty,c)=-2+8c^{2}>0,\quad A_{2}(\infty,c)=-2+32c^{2}>0. (26)

Thus, we get the following necessary condition

c>12c>\frac{1}{2} (27)

for the function g(c,α,n)g(c,\alpha,n). Kuiper [1] pointed out that a necessary condition for cc is c>6/5=1.2c>6/5=1.2 when the first term is considered in the infinite series for (12). On the other hand, the larger the nn is, the larger cc is feasible according to the definition of critical value in the sense of large samples in statistics. Hence for fixed α\alpha and nn\to\infty, we can find that cαc^{\alpha}_{\infty} gives the upper bound of the variable cc. For α=1010\alpha=10^{-10}, we can find that cα3.7226<4c^{\alpha}_{\infty}\approx 3.7226<4.

3.1.1 Direct Iterative Method

Let

fctm1(c,α,n)=ln[A1(c,n)+A2(c,n)e6c2]lnα2,{f}_{\mathrm{ctm1}}(c,\alpha,n)=\sqrt{\frac{\ln\left[A_{1}(c,n)+A_{2}(c,n)\cdot\mathrm{e}^{-6c^{2}}\right]-\ln\alpha}{2}}, (28)

then (23) implies that

c=𝒜nα(fctm1,c)=fctm1(c,α,n).c=\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c)={f}_{\mathrm{ctm1}}(c,\alpha,n). (29)

It is easy to verify that 𝒜nα(fctm1,)\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},\cdot) is a contractive mapping for the given positive integer nn and upper tail probability α(0,1)\alpha\in(0,1) for appropriate domain of cc, say c(0.5,2.5)c\in(0.5,2.5). Consequently, the fixed-point theorem implies that the iterative formula

ci+1=𝒜nα(fctm1,ci),i=0,1,2,c_{i+1}=\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c_{i}),\quad i=0,1,2,\cdots (30)

must converge if the initial value cguess(0.5,2.5){c}_{\mathrm{guess}}\in(0.5,2.5).

Refer to caption
(a) α=0.10,n=30,cnα=1.5503\alpha=0.10,n=30,c^{\alpha}_{n}=1.5503
Refer to caption
(b) α=0.05,n=30,cnα=1.6758\alpha=0.05,n=30,c^{\alpha}_{n}=1.6758
Refer to caption
(c) α=0.02,n=30,cnα=1.8235\alpha=0.02,n=30,c^{\alpha}_{n}=1.8235
Refer to caption
(d) α=0.01,n=30,cnα=1.9252\alpha=0.01,n=30,c^{\alpha}_{n}=1.9252
Figure 1: The intersection of y=cy=c and y=𝒜nα(fctm1,c)=fctm1(c,α,n)y=\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c)={f}_{\mathrm{ctm1}}(c,\alpha,n) for α{0.10,0.05,0.02,0.01}\alpha\in\left\{0.10,0.05,0.02,0.01\right\} and n=30n=30.

Figure 1 demonstrates the intersection of y=𝒜nα(fctm1,c)y=\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c) and y=cy=c clearly. It is easy to find that the absolute value of the derivative |ddc𝒜nα(fctm1,c)|<1\left|\frac{\operatorname{d}{}}{\operatorname{d}{c}}\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c)\right|<1 (and it is small enough) for c(0.5,3)c\in(0.5,3) such that 𝒜nα(fctm1,c)\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c) is a good contractive mapping. For (α,n)=(0.10,30)(\alpha,n)=(0.10,30) and (α,n)=(0.05,30)(\alpha,n)=(0.05,30), there are two intersection points for the line y=cy=c and the curve y=𝒜nα(fctm1,c)y=\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c), and the solutions cnα<0.5c^{\alpha}_{n}<0.5 are discarded. For (α,n)=(0.02,30)(\alpha,n)=(0.02,30) and (α,n)=(0.01,30)(\alpha,n)=(0.01,30), there is just one intersection point for the line y=cy=c and the curve y=𝒜nα(fctm1,c)y=\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c), and the feasible solution cnαc^{\alpha}_{n} is larger than 1.51.5. It is obvious that for the fixed nn, the smaller the α\alpha is, the larger the cnαc^{\alpha}_{n} is.

3.1.2 Newton’s Iterative Method

The Newton’s iterative formula for Kuiper’s VnV_{n}-test can be written by

ci+1=nα(fnlm1,ci)c_{i+1}=\mathcal{B}^{\alpha}_{n}({f}_{\mathrm{nlm1}},c_{i}) (31)

where

nα(fnlm1,c)=cfnlm1(c,α,n)fnlm1(c,α,n),\mathcal{B}^{\alpha}_{n}({f}_{\mathrm{nlm1}},c)=c-\frac{{f}_{\mathrm{nlm1}}(c,\alpha,n)}{{f}_{\mathrm{nlm1}}(c,\alpha,n)}, (32)

is the Newton’s updating function. The mapping nα(fnlm1,c)\mathcal{B}^{\alpha}_{n}({f}_{\mathrm{nlm1}},c) is a contractive mapping for appropriate domain of cc, say c(1,2)c\in(1,2). The initial value for the Newton’s iterative method could be set by cguess=1.2{c}_{\mathrm{guess}}=1.2.

Refer to caption
(a) α=0.10,n=30,cnα=1.5503\alpha=0.10,n=30,c^{\alpha}_{n}=1.5503
Refer to caption
(b) α=0.05,n=30,cnα=1.6758\alpha=0.05,n=30,c^{\alpha}_{n}=1.6758
Refer to caption
(c) α=0.02,n=30,cnα=1.8235\alpha=0.02,n=30,c^{\alpha}_{n}=1.8235
Refer to caption
(d) α=0.01,n=30,cnα=1.9252\alpha=0.01,n=30,c^{\alpha}_{n}=1.9252
Figure 2: Curve and root of fnlm1(c,α,n){f}_{\mathrm{nlm1}}(c,\alpha,n) for α{0.10,0.05,0.02,0.01}\alpha\in\left\{0.10,0.05,0.02,0.01\right\} and n=30n=30

Figure 2 shows the curve of fnlm1(c,α,n){f}_{\mathrm{nlm1}}(c,\alpha,n) for c(0,3)c\in(0,3) and fixed α\alpha and nn. It should be noted that the necessary condition c>1/2c>1/2 automatically rejects the possible root which lies in the open interval (0,0.5)(0,0.5). Although the diagram in Figure 2 is different its counterpart in Figure 1, the solution cnαc^{\alpha}_{n} obtained with the Newton’s iterative method via fnlm1(c,α,n){f}_{\mathrm{nlm1}}(c,\alpha,n) is the same as that obtained by the direct iterative method via fctm1(c,α,n){f}_{\mathrm{ctm1}}(c,\alpha,n).

3.1.3 Kuiper’s Pair for Kuiper’s VnV_{n}-test

With the help of the two contractive mappings 𝒜nα(fctm1,)\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},\cdot) and nα(fnlm1,)\mathcal{B}^{\alpha}_{n}({f}_{\mathrm{nlm1}},\cdot), the fixed-point cnαc^{\alpha}_{n} for the equation (23) can be solved with the direct iterative method or Newton’s iterative method, which is the critical value such that α=Pr{Kn>cnα}\alpha=\Pr\left\{K_{n}>c^{\alpha}_{n}\right\}. The relation of the critical value cnαc^{\alpha}_{n} and upper tail probability vnαv^{\alpha}_{n} can be expressed by

vnα=cnαnv^{\alpha}_{n}=\frac{c^{\alpha}_{n}}{\sqrt{n}} (33)

since we have

α=Pr{nVn>cnα}=Pr{Vn>cnα/n}=Pr{Vn>vnα}\alpha=\Pr\left\{\sqrt{n}\cdot V_{n}>c^{\alpha}_{n}\right\}=\Pr\left\{V_{n}>c^{\alpha}_{n}/\sqrt{n}\right\}=\Pr\left\{V_{n}>v^{\alpha}_{n}\right\} (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 cnα,vnα\left\langle{c^{\alpha}_{n}},{v^{\alpha}_{n}}\right\rangle with the fixed-point method.

3.2 Computation of the Pairs for Kuiper’s Vn,nV_{n,n}-Test

For the Kuiper’s Vn,nV_{n,n}-test, there is also a formula for the upper tail probability [1, 14]

1α=Pr{nVn,nc}=1j=12(2j2c21)ej2c2+16n[1+j=1j2c2(2j2c27)ej2c2]+𝒪(1n2).1-\alpha=\Pr\left\{\sqrt{n}\cdot V_{n,n}\leq c\right\}=1-\sum^{\infty}_{j=1}2(2j^{2}c^{2}-1)\mathrm{e}^{-j^{2}c^{2}}+\frac{1}{6n}\left[1+\sum^{\infty}_{j=1}j^{2}c^{2}(2j^{2}c^{2}-7)\mathrm{e}^{-j^{2}c^{2}}\right]+\mathcal{O}\left(\frac{1}{n^{2}}\right). (35)

We can approximate the infinite series with the first and second term as done for the VnV_{n}-test, which implies that

α\displaystyle\alpha 2(2c21)ec2+2(8c21)e4c216n[1+c2(2c27)ec2+4c2(8c27)e4c2]\displaystyle\approx 2(2c^{2}-1)\mathrm{e}^{-c^{2}}+2(8c^{2}-1)\mathrm{e}^{-4c^{2}}-\frac{1}{6n}\left[1+c^{2}(2c^{2}-7)\mathrm{e}^{-c^{2}}+4c^{2}(8c^{2}-7)\mathrm{e}^{-4c^{2}}\right] (36)
=16n+[2(2c21)c2(2c27)6n]ec2+[2(8c21)2c2(8c27)3n]e4c2.\displaystyle=-\frac{1}{6n}+\left[2(2c^{2}-1)-\frac{c^{2}(2c^{2}-7)}{6n}\right]\mathrm{e}^{-c^{2}}+\left[2(8c^{2}-1)-\frac{2c^{2}(8c^{2}-7)}{3n}\right]\mathrm{e}^{-4c^{2}}.

Let

U1(c,n)=2(2c21)c2(2c27)6nec26n,U2(c,n)=2(8c21)2c2(8c27)3n,U_{1}(c,n)=2(2c^{2}-1)-\frac{c^{2}(2c^{2}-7)}{6n}-\frac{\mathrm{e}^{c^{2}}}{6n},\quad U_{2}(c,n)=2(8c^{2}-1)-\frac{2c^{2}(8c^{2}-7)}{3n}, (37)

then we can deduce that

c2+lnα=ln[U1(c,n)+U2(c,n)e3c2].\boxed{c^{2}+\ln\alpha=\ln\left[U_{1}(c,n)+U_{2}(c,n)\mathrm{e}^{-3c^{2}}\right]}. (38)

Let

fnlm2(c,α,n)=c2+lnαln[U1(c,n)+U2(c,n)e3c2]{f}_{\mathrm{nlm2}}(c,\alpha,n)=c^{2}+\ln\alpha-\ln\left[U_{1}(c,n)+U_{2}(c,n)\mathrm{e}^{-3c^{2}}\right] (39)

where the digit 22 in the subscript ”nlm2” denotes the double nn in Vn,nV_{n,n} and

𝒜n,nα(fctm2,c)=fctm2(c,α,n)=ln[U1(c,n)+U2(c,n)e3c2]lnα\mathcal{A}^{\alpha}_{n,n}({f}_{\mathrm{ctm2}},c)={f}_{\mathrm{ctm2}}(c,\alpha,n)=\sqrt{\ln\left[U_{1}(c,n)+U_{2}(c,n)\mathrm{e}^{-3c^{2}}\right]-\ln\alpha} (40)

We also can construct two iterative formulas for solving the nonlinear equation

fnlm2(c,α,n)=0{f}_{\mathrm{nlm2}}(c,\alpha,n)=0 (41)

to solve the cn,nαc^{\alpha}_{n,n} as follows:

  • Newton’s iterative method:

    ci+1=n,nα(fnlm2,ci)=cifnlm2(ci,α,n)fnlm2(ci,α,n)c_{i+1}=\mathcal{B}^{\alpha}_{n,n}({f}_{\mathrm{nlm2}},c_{i})=c_{i}-\frac{{f}_{\mathrm{nlm2}}(c_{i},\alpha,n)}{{f}_{\mathrm{nlm2}}^{\prime}(c_{i},\alpha,n)} (42)
  • direct iterative method:

    ci+1=𝒜n,nα(fctm2,ci)=fctm2(ci,α,n)=ln[U1(ci,n)+U2(ci,n)e3ci2]lnαc_{i+1}=\mathcal{A}^{\alpha}_{n,n}({f}_{\mathrm{ctm2}},c_{i})={f}_{\mathrm{ctm2}}(c_{i},\alpha,n)=\sqrt{\ln\left[U_{1}(c_{i},n)+U_{2}(c_{i},n)\mathrm{e}^{-3c_{i}^{2}}\right]-\ln\alpha} (43)

Just like the process of solving cnαc^{\alpha}_{n}, the cn,nαc^{\alpha}_{n,n} defined by

α=Pr{nVn,n>cn,nα}\alpha=\Pr\left\{\sqrt{n}\cdot V_{n,n}>c^{\alpha}_{n,n}\right\} (44)

is the limit of the sequence c0,c1,c2,c_{0},c_{1},c_{2},\cdots generated by 𝒜n,nα(fctm2,c)\mathcal{A}^{\alpha}_{n,n}({f}_{\mathrm{ctm2}},c) and n,nα(fnlm2,c)\mathcal{B}^{\alpha}_{n,n}({f}_{\mathrm{nlm2}},c). The initial value for solving cn,nαc^{\alpha}_{n,n} can be observed from the figure of y=fnlm2(c,α,n)y={f}_{\mathrm{nlm2}}(c,\alpha,n) with the variable cc intuitively. It should be noted that there is no modified version of the Vn,nV_{n,n}-test due to the error bound for the approximation in (35) is 𝒪(n2)\mathcal{O}\left(n^{-2}\right) instead of 𝒪(n1)\mathcal{O}\left(n^{-1}\right).

Refer to caption
(a) α=0.10,n=30,cnα=2.2740\alpha=0.10,n=30,c^{\alpha}_{n}=2.2740
Refer to caption
(b) α=0.05,n=30,cnα=2.4430\alpha=0.05,n=30,c^{\alpha}_{n}=2.4430
Refer to caption
(c) α=0.02,n=30,cnα=2.6266\alpha=0.02,n=30,c^{\alpha}_{n}=2.6266
Refer to caption
(d) α=0.01,n=30,cnα=2.7351\alpha=0.01,n=30,c^{\alpha}_{n}=2.7351
Figure 3: Intersection of y=cy=c and y=𝒜n,nα(fctm2,α,n)=fctm2(c,α,n)y=\mathcal{A}^{\alpha}_{n,n}({f}_{\mathrm{ctm2}},\alpha,n)={f}_{\mathrm{ctm2}}(c,\alpha,n) for α{0.10,0.05,0.02,0.01}\alpha\in\left\{0.10,0.05,0.02,0.01\right\} and n=30n=30.
Refer to caption
(a) α=0.10,n=30,cnα=2.2740\alpha=0.10,n=30,c^{\alpha}_{n}=2.2740
Refer to caption
(b) α=0.05,n=30,cnα=2.4430\alpha=0.05,n=30,c^{\alpha}_{n}=2.4430
Refer to caption
(c) α=0.02,n=30,cnα=2.6266\alpha=0.02,n=30,c^{\alpha}_{n}=2.6266
Refer to caption
(d) α=0.01,n=30,cnα=2.7351\alpha=0.01,n=30,c^{\alpha}_{n}=2.7351
Figure 4: Curve and root of fnlm2(c,α,n)=0{f}_{\mathrm{nlm2}}(c,\alpha,n)=0 for α{0.10,0.05,0.02,0.01}\alpha\in\left\{0.10,0.05,0.02,0.01\right\} and n=30n=30.

As an illustration, Figure 3 shows the critical value cn,nαc^{\alpha}_{n,n} of the statistic Vn,nV_{n,n} with the direct iterative method via fctm2(c,α,n){f}_{\mathrm{ctm2}}(c,\alpha,n), in which α{0.10,0.05,0.02,0.01}\alpha\in\left\{0.10,0.05,0.02,0.01\right\} and n=30n=30. Similarly, Figure 4 shows the counterpart of cn,nαc^{\alpha}_{n,n} with the Newton’s iterative method via fnlm2(c,α,n){f}_{\mathrm{nlm2}}(c,\alpha,n). It should be noted that when the α\alpha decreases, the critical value cn,nαc^{\alpha}_{n,n} increases.

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 cnα,vnα\left\langle{c^{\alpha}_{n}},{v^{\alpha}_{n}}\right\rangle, 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 A1(c,n)A_{1}(c,n) and A2(c,n)A_{2}(c,n) respectively.

 

Algorithm 3 Calculating the value of A1(c,n)A_{1}(c,n) arising in the updating function in VnV_{n}-test

 
1:Positive critical value cc, positive integer nn
2:The value of A1(c,n)A_{1}(c,n).
3:function FunA1cn(c,nc,n)
4:  A12+8c/n+8c232c3/(3n)A_{1}\leftarrow-2+8c/\sqrt{n}+8c^{2}-32c^{3}/(3\sqrt{n});
5:  return A1A_{1};
6:end function
 
 

Algorithm 4 Calculating the value of A2(c,n)A_{2}(c,n) arising in the VnV_{n}-test

 
1:Positive critical value cc, positive integer nn
2:The value of A2(c,n)A_{2}(c,n).
3:function FunA2cn(c,nc,n)
4:  A22+32c/n+32c2512c3/(3n)A_{2}\leftarrow-2+32c/\sqrt{n}+32c^{2}-512c^{3}/(3\sqrt{n});
5:  return A2A_{2};
6:end function
 

The procedures FunFnlm1 and FunFnlm2 in Algorithm 4.1 and Algorithm 4.1 are designed for computing the non-linear functions fnlm1(c,α,n){f}_{\mathrm{nlm1}}(c,\alpha,n) for the VnV_{n}-test and fnlm2(c,α,n){f}_{\mathrm{nlm2}}(c,\alpha,n) for the Vn,nV_{n,n}-test respectively.

 

Algorithm 5 Calculating the value of fnlm1(c,α,n){f}_{\mathrm{nlm1}}(c,\alpha,n) for the updating function in VnV_{n}-test

 
1:Positive critical value cc, upper tail probability α\alpha, integer nn
2:The value of fnlm1(c,α,n){f}_{\mathrm{nlm1}}(c,\alpha,n).
3:function FunFnlm1(c,α,nc,\alpha,n)
4:  A1FunA1cn(c,n)A_{1}\leftarrow\textsc{FunA1cn}(c,n);
5:  A2FunA2cn(c,n)A_{2}\leftarrow\textsc{FunA2cn}(c,n);
6:  u2c2+lnαln(A1+A2e6c2)u\leftarrow 2c^{2}+\ln\alpha-\ln\left(A_{1}+A_{2}\cdot\mathrm{e}^{-6c^{2}}\right);
7:  return uu;
8:end function
 
 

Algorithm 6 Calculating the value of fnlm2(c,α,n){f}_{\mathrm{nlm2}}(c,\alpha,n) for the updating function in Vn,nV_{n,n}-test

 
1:Positive critical value cc, upper tail probability α\alpha, integer nn
2:The value of fnlm2(c,α,n){f}_{\mathrm{nlm2}}(c,\alpha,n).
3:function FunFnlm2(c,α,nc,\alpha,n)
4:  xc2x\leftarrow c^{2};
5:  U12(2x1)x(2x7)/(6n)ex/(6n)U_{1}\leftarrow 2(2x-1)-x(2x-7)/(6n)-\mathrm{e}^{x}/(6n);
6:  U22(8x1)2x(8x7)/(3n)U_{2}\leftarrow 2(8x-1)-2x(8x-7)/(3n);
7:  ux+lnαln(U1+U2e3x)u\leftarrow x+\ln\alpha-\ln\left(U_{1}+U_{2}\cdot\mathrm{e}^{-3x}\right);
8:  return uu;
9:end function
 

The procedures FunFctm1 and FunFctm2 in Algorithm 4.1 and Algorithm 4.1 are designed for computing the non-linear functions fctm1(c,α,n){f}_{\mathrm{ctm1}}(c,\alpha,n) for the VnV_{n}-test and fnct2(c,α,n){f}_{\mathrm{nct2}}(c,\alpha,n) for the Vn,nV_{n,n}-test respectively.

 

Algorithm 7 Calculating the fctm1(c,α,n){f}_{\mathrm{ctm1}}(c,\alpha,n) for the updating operator 𝒜nα(f,c)\mathcal{A}^{\alpha}_{n}(f,c) in VnV_{n}-test

 
1:Positive critical value cc, upper tail probability α\alpha, integer nn
2:The value of the direct updating function 𝒜nα(c)\mathcal{A}^{\alpha}_{n}(c).
3:function FunFctm1(c,α,nc,\alpha,n)
4:  AFunA1cn(c,n)A\leftarrow\textsc{FunA1cn}(c,n);
5:  BFunA2cn(c,n)B\leftarrow\textsc{FunA2cn}(c,n);
6:  y(ln(A+Be6c2)lnα)/2y\leftarrow\sqrt{\left(\ln(A+B\cdot\mathrm{e}^{-6c^{2}})-\ln\alpha\right)/2};
7:  return yy;
8:end function
 
 

Algorithm 8 Calculating the fctm2(c,α,n){f}_{\mathrm{ctm2}}(c,\alpha,n) for the updating operator 𝒜n,nα(f,c)\mathcal{A}^{\alpha}_{n,n}(f,c) in Vn,nV_{n,n}-test

 
1:Positive critical value cc, pper tail probability α\alpha, integer nn
2:The value of the fctm2(c,α,n){f}_{\mathrm{ctm2}}(c,\alpha,n).
3:function FunFctm2(c,α,nc,\alpha,n)
4:  xc2x\leftarrow c^{2};
5:  U12(2x1)x(2x7)/(6n)ex/(6n)U_{1}\leftarrow 2(2x-1)-x(2x-7)/(6n)-\mathrm{e}^{x}/(6n);
6:  U22(8x1)2x(8x7)/(3n)U_{2}\leftarrow 2(8x-1)-2x(8x-7)/(3n);
7:  yln(U1+U2e3x)lnαy\leftarrow\sqrt{\ln(U_{1}+U_{2}\cdot\mathrm{e}^{-3x})-\ln\alpha};
8:  return yy;
9:end function
 

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 𝒜nα(f,c)\mathcal{A}^{\alpha}_{n}(f,c) for the VnV_{n}-test and 𝒜n,nα(f,c)\mathcal{A}^{\alpha}_{n,n}(f,c) for the Vn,nV_{n,n}-test with a unified interface for the direct iterative method.

 

Algorithm 9 Calculating the Contractive Mapping 𝒜nα(f,c)\mathcal{A}^{\alpha}_{n}(f,c) and 𝒜n,nα(f,c)\mathcal{A}^{\alpha}_{n,n}(f,c)

 
1:Contractive function fctm(c,α,n){f}_{\mathrm{ctm}}(c,\alpha,n), critical value cc, upper tail probability α\alpha, integer nn
2:The value of the direct updating function 𝒜nα(fctm1,c)\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c) or 𝒜n,nα(fctm2,c)\mathcal{A}^{\alpha}_{n,n}({f}_{\mathrm{ctm2}},c).
  • if fctm=fctm1{f}_{\mathrm{ctm}}={f}_{\mathrm{ctm1}}, then we get 𝒜nα(fctm1,c)\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c) in VnV_{n}-test and

  • if fctm=fctm2{f}_{\mathrm{ctm}}={f}_{\mathrm{ctm2}}, then we get 𝒜n,nα(fctm2,c)\mathcal{A}^{\alpha}_{n,n}({f}_{\mathrm{ctm2}},c) in Vn,nV_{n,n}-test.

3:function UpdateMethodDirect(fctm,c,α,n{f}_{\mathrm{ctm}},c,\alpha,n)
4:  ufctm(c,α,n)u\leftarrow{f}_{\mathrm{ctm}}(c,\alpha,n);
5:  return uu;
6:end function
 

Similarly, The high order procedure UpdateMethodNewton in Algorithm 4.2 is designed for computing the contractive mapping nα(f,c)\mathcal{B}^{\alpha}_{n}(f,c) for the VnV_{n}-test and n,nα(f,c)\mathcal{B}^{\alpha}_{n,n}(f,c) for the Vn,nV_{n,n}-test with a unified interface for the Newton iterative method.

 

Algorithm 10 Calculating the Newton’s updating functions nα(fnlm,c)\mathcal{B}^{\alpha}_{n}({f}_{\mathrm{nlm}},c) and n,nα(fnlm,c)\mathcal{B}^{\alpha}_{n,n}({f}_{\mathrm{nlm}},c)

 
1:Nonlinear function fnlm(α,n,c){f}_{\mathrm{nlm}}(\alpha,n,c), upper tail probability α\alpha, integer nn, critical value cc
2:The value of the Newton’s updating function nα(fnlm,c)\mathcal{B}^{\alpha}_{n}({f}_{\mathrm{nlm}},c) or n,nα(fnlm,c)\mathcal{B}^{\alpha}_{n,n}({f}_{\mathrm{nlm}},c).
  • if fnlm=fnlm1{f}_{\mathrm{nlm}}={f}_{\mathrm{nlm1}}, then we get nα(fnlm1,c)\mathcal{B}^{\alpha}_{n}({f}_{\mathrm{nlm1}},c) in VnV_{n}-test and

  • if fnlm=fnlm2{f}_{\mathrm{nlm}}={f}_{\mathrm{nlm2}}, then we get n,nα(fnlm2,c)\mathcal{B}^{\alpha}_{n,n}({f}_{\mathrm{nlm2}},c) in Vn,nV_{n,n}-test.

3:function UpdateMethodNewton(fnlm,α,n,c{f}_{\mathrm{nlm}},\alpha,n,c)
4:  h105h\leftarrow 10^{-5};
5:  slope(fnlm(c+h,α,n)fnlm(c,α,n))/h\texttt{slope}\leftarrow\left({f}_{\mathrm{nlm}}(c+h,\alpha,n)-{f}_{\mathrm{nlm}}(c,\alpha,n)\right)/h; // Calculate the derivative fnlm(c,α,n){f}_{\mathrm{nlm}}^{\prime}(c,\alpha,n)
6:  cnewcfnlm(c,α,n)/slope{c}_{\mathrm{new}}\leftarrow c-{f}_{\mathrm{nlm}}(c,\alpha,n)/\texttt{slope};
7:  return cnew{c}_{\mathrm{new}};
8:end function
 

4.3 Algorithms for Solving the Kuiper Pair for VnV_{n}-test and Vn,nV_{n,n}-test

It is significant for us to calculate the original Kuiper pair cα,vα\left\langle{c^{\alpha}_{\star}},{v^{\alpha}_{\star}}\right\rangle for Kuiper’s VV_{\star}-test where V{Vn,Vn,n}V_{\star}\in\left\{V_{n},V_{n,n}\right\}. The procedure KuiperPairSolver listed in Algorithm 4.3 provides a unified framework for solving the Kuiper pair cα,vα\left\langle{c^{\alpha}_{\star}},{v^{\alpha}_{\star}}\right\rangle with the Direct or Newton’s iterative method.

 

Algorithm 11 Fixed-point iterative algorithm for solving the Kuiper’s pair cnα,vnα\left\langle{c^{\alpha}_{n}},{v^{\alpha}_{n}}\right\rangle in VnV_{n}-test or cn,nα,vn,nα\left\langle{c^{\alpha}_{n,n}},{v^{\alpha}_{n,n}}\right\rangle in Vn,nV_{n,n}-test with the while-do loop and direct/Newton iterative method

 
1:The number of samples nn, upper tail probability α(0,1)\alpha\in(0,1), guess of the critical value cguess{c}_{\mathrm{guess}} with default value cguess=2.45{c}_{\mathrm{guess}}=2.45, integer method{1,2}\texttt{method}\in\left\{1,2\right\} for the Direct/Newton iterative method with default value method=2\texttt{method}=2 for the Newton’s iterative method, integer type{1,2}\texttt{type}\in\left\{1,2\right\} for the VnV_{n}-test and Vn,nV_{n,n}-test with default value 1.
2:The Kuiper pair cα,vα\left\langle{c^{\alpha}_{\star}},{v^{\alpha}_{\star}}\right\rangle such that α=Pr{nV>cα}=Pr{Vvα}\alpha=\Pr\left\{\sqrt{n}\cdot V_{\star}>c^{\alpha}_{\star}\right\}=\Pr\left\{V_{\star}\geq v^{\alpha}_{\star}\right\} for V{Vn,Vn,n}V_{\star}\in\left\{V_{n},V_{n,n}\right\}.
3:function KuiperPairSolver(cguess,α,n,type,method{c}_{\mathrm{guess}},\alpha,n,\texttt{type},\texttt{method})
4:  if (method==1type == 1\texttt{method}==1\land\texttt{type == 1}then
5:   TUpdateMethodDirect\textsc{T}\leftarrow\textsc{UpdateMethodDirect}; // using direct iterative method
6:   fFunFctm1f\leftarrow\textsc{FunFctm1}; // Solve the fixed-point by c=𝒜nα(fctm1,c)c=\mathcal{A}^{\alpha}_{n}({f}_{\mathrm{ctm1}},c) in VnV_{n}-test
7:  end if
8:  if (method==1type == 2\texttt{method}==1\land\texttt{type == 2}then
9:   TUpdateMethodDirectT\leftarrow\textsc{UpdateMethodDirect}; // using direct iterative method
10:   fFunFctm2f\leftarrow\textsc{FunFctm2}; // Solve the fixed-point by c=𝒜n,nα(fctm2,c)c=\mathcal{A}^{\alpha}_{n,n}({f}_{\mathrm{ctm2}},c) in Vn,nV_{n,n}-test
11:  end if
12:  if (method==2type == 1\texttt{method}==2\land\texttt{type == 1}then
13:   TUpdateMethodNewtonT\leftarrow\textsc{UpdateMethodNewton}; // using Newton’s iterative method
14:   fFunFnlm1f\leftarrow\textsc{FunFnlm1}; // solve the nonlinear eq. fnlm1(c,α,n)=0{f}_{\mathrm{nlm1}}(c,\alpha,n)=0 in VnV_{n}-test
15:  end if
16:  if (method==2type == 2\texttt{method}==2\land\texttt{type == 2}then
17:   TUpdateMethodNewtonT\leftarrow\textsc{UpdateMethodNewton}; // using Newton’s iterative method
18:   fFunFnlm2f\leftarrow\textsc{FunFnlm2}; // solve the nonlinear eq. fnlm2(c,α,n)=0{f}_{\mathrm{nlm2}}(c,\alpha,n)=0 in Vn,nV_{n,n}-test
19:  end if
20:  ϵ105\epsilon\leftarrow 10^{-5};
21:  dDistanced\leftarrow\textsc{Distance}; // distance function
22:  cαFixedPointSolver(T,f,d,ϵ,cguess,α,n)c^{\alpha}_{\star}\leftarrow\textsc{FixedPointSolver}(T,f,d,\epsilon,{c}_{\mathrm{guess}},\alpha,n);
23:  vαcα/nv^{\alpha}_{\star}\leftarrow c^{\alpha}_{\star}/\sqrt{n};
24:  return cα,vα\left\langle{c^{\alpha}_{\star}},{v^{\alpha}_{\star}}\right\rangle; // Kuiper pair for the VV_{\star}-test
25:end function
 

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 cnαc^{\alpha}_{n} and our emphasis is put on the upper/lower tail quantile vnα=v1αnv^{\alpha}_{n}=v_{1-\alpha}^{n} in VnV_{n}-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 VnV_{n}-test

 
1:Upper tail probability α(0,1)\alpha\in(0,1), capacity nn of the samples.
2:Upper tail quantile vnαv^{\alpha}_{n} for the VnV_{n} statistic such that α=Pr{Vn>v}\alpha=\Pr\left\{V_{n}>v\right\}.
3:function KuiperUTQ(α,n\alpha,n)
4:  if α0.9999\alpha\geq 0.9999 then
5:   return 0.00.0;
6:  end if
7:  TUpdateMethodNewtonT\leftarrow\textsc{UpdateMethodNewton}; // using Newton’s iterative method
8:  fFunFnlm1f\leftarrow\textsc{FunFnlm1};  // solve the nonlinear eq. fnlm1(c,α,n)=0{f}_{\mathrm{nlm1}}(c,\alpha,n)=0 in VnV_{n}-test
9:  ϵ105\epsilon\leftarrow 10^{-5};  // precision for the fixed-point
10:  dDistanced\leftarrow\textsc{Distance};  // distance function
11:  cguess2.45{c}_{\mathrm{guess}}\leftarrow 2.45;  // cguess(1.1,2.5){c}_{\mathrm{guess}}\in(1.1,2.5) is OK.
12:  cnαFixedPointSolver(T,f,d,ϵ,cguess,α,n)c^{\alpha}_{n}\leftarrow\textsc{FixedPointSolver}(T,f,d,\epsilon,{c}_{\mathrm{guess}},\alpha,n);
13:  vnαcnα/nv^{\alpha}_{n}\leftarrow c^{\alpha}_{n}/\sqrt{n};
14:  return vnαv^{\alpha}_{n};
15:end function
 

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 vαn=vn1αv_{\alpha}^{n}=v^{1-\alpha}_{n}. In other words, we have KuiperLTQ(α,n)KuiperUTQ(1α,n)\textsc{KuiperLTQ}(\alpha,n)\equiv\textsc{KuiperUTQ}(1-\alpha,n) for any α[0,1]\alpha\in[0,1].

 

Algorithm 13 Compute the Lower Tail Quantile vαnv_{\alpha}^{n} in Kuiper’s VnV_{n}-test

 
1:Lower tail probability α(0,1)\alpha\in(0,1), capacity nn of the samples.
2:Lower tail quantile vαnv_{\alpha}^{n} in Kuiper’s VnV_{n}-test.
3:function KuiperLTQ(α,n\alpha,n)
4:  if α0.0001\alpha\leq 0.0001 then
5:   return 0.00.0;
6:  end if
7:  cguess2.45{c}_{\mathrm{guess}}\leftarrow 2.45; // vguess(1.1,2.5){v}_{\mathrm{guess}}\in(1.1,2.5) is OK
8:  type1\texttt{type}\leftarrow 1;  // Kuiper’s VnV_{n}-test
9:  method2\texttt{method}\leftarrow 2;  // Newton’s iterative method
10:  c,vKuiperPairSolver(cguess,1α,n,type,method)\left\langle{c},{v}\right\rangle\leftarrow\textsc{KuiperPairSolver}({c}_{\mathrm{guess}},1-\alpha,n,\texttt{type},\texttt{method});
11:  return vv;  // lower tail quantile, v=vα=v1αv=v_{\alpha}=v^{1-\alpha}
12:end function
 

For the applications of goodness-of-fit test where Kuiper’s VnV_{n}-test is involved, it is the inverse of the CDF of VnV_{n} that must be solved according to (4) or (6). It is easy to find that

vxn=FVn1(x),x[x,1]v_{x}^{n}=F^{-1}_{V_{n}}(x),\quad\forall x\in[x,1] (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 FVn1(x)F^{-1}_{V_{n}}(x) for any probability x[0,1]x\in[0,1].

 

Algorithm 14 Compute the inverse CDF FVn1(x)F^{-1}_{V_{n}}(x) for Kuiper’s VnV_{n}-test

 
1:Probability x[0,1]x\in[0,1], capacity nn of the samples
2:The value of FVn1(x)F^{-1}_{V_{n}}(x) of the Kuiper’s VnV_{n}-test.
3:function KuiperInvCDF(x,nx,n)
4:  yKuiperUTQ(1.0x,n)y\leftarrow\textsc{KuiperUTQ}(1.0-x,n);  // yKuiperLTQ(x,n)y\leftarrow\textsc{KuiperLTQ}(x,n) is OK.
5:  return yy;
6:end function
 

5 Verification and Validation

5.1 An Error in Kuiper’s Numerical Results

Kuiper [1] presented a table of the critical value cnαc^{\alpha}_{n} for α{0.01,0.05,0.1}\alpha\in\left\{0.01,0.05,0.1\right\} and n{10,20,30,40,100,+}n\in\left\{10,20,30,40,100,+\infty\right\}, see Table 1.

Table 1: Kuiper’s critical value cnαc^{\alpha}_{n} such that α=Pr{nVn>cnα}\alpha=\Pr\left\{\sqrt{n}\cdot V_{n}>c^{\alpha}_{n}\right\}
α\alpha nn cnαc^{\alpha}_{n} 1010 2020 3030 4040 100100 ++\infty
0.100.10 1.18771.1877 1.53221.5322 1.55031.5503 1.56081.5608 1.58391.5839 1.61961.6196
0.050.05 1.60661.6066 1.65641.6564 1.67601.6760 1.68691.6869 1.71101.7110 1.74731.7473
0.010.01 1.83911.8391 1.90271.9027 1.9153\bf{1.9153} 1.93751.9375 1.96371.9637 2.00102.0010

For the configuration of α\alpha and nn, the Kuiper pair for Kuiper’s VnV_{n}-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 cnα,vnα\left\langle{c^{\alpha}_{n}},{v^{\alpha}_{n}}\right\rangle. 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 n{180,106}n\in\left\{180,10^{6}\right\} are added in the table. Moreover, the readers can get more effective digits with our code released on the GitHub.

Table 2: Kuiper pair for Kuiper’s VnV_{n}-test where α=Pr{nVn>cnα}=Pr{Vn>vnα}\alpha=\Pr\left\{\sqrt{n}\cdot V_{n}>c^{\alpha}_{n}\right\}=\Pr\left\{V_{n}>v^{\alpha}_{n}\right\}
α\alpha nn (cnα,vnα)(c^{\alpha}_{n},v^{\alpha}_{n}) 1010 2020 3030 4040 100100 180180 10610^{6}
0.100.10 (1.4877,0.4704)(1.4877,0.4704) (1.5322,0.3426)(1.5322,0.3426) (1.5503,0.2830)(1.5503,0.2830) (1.5606,0.2468)(1.5606,0.2468) (1.5838,0.1584)(1.5838,0.1584) (1.5934,0.1188)(1.5934,0.1188) (1.6193,0.0016)(1.6193,0.0016)
0.050.05 (1.6066,0.5080)(1.6066,0.5080) (1.6563,0.3704)(1.6563,0.3704) (1.6758,0.3060)(1.6758,0.3060) (1.6868,0.2667)(1.6868,0.2667) (1.7110,0.1711)(1.7110,0.1711) (1.7208,0.1283)(1.7208,0.1283) (1.7469,0.0017)(1.7469,0.0017)
0.010.01 (1.8401,0.5819)(1.8401,0.5819) (1.9026,0.4254)(1.9026,0.4254) (1.9252,0.3515)\bf{(1.9252,0.3515)} (1.9374,0.3063)(1.9374,0.3063) (1.9636,0.1964)(1.9636,0.1964) (1.9739,0.1471)(1.9739,0.1471) (2.0006,0.0020)(2.0006,0.0020)

It should be noted that there is an error in Kuiper’s table for (α,n,cnα)=(0.01,30,1.9153)(\alpha,n,c^{\alpha}_{n})=(0.01,30,1.9153). The comparison of Table 2 and Table 1 shows that the value c300.01c^{0.01}_{30} by Kuiper is wrong with the help of our code released on GitHub. Obviously, the correct value should be c300.01=1.9252c^{0.01}_{30}=1.9252 by our algorithms and code or c300.01=1.9253c^{0.01}_{30}=1.9253 according to Kuiper’s approximation in which only the term ()e2c2(\cdot)\mathrm{e}^{-2c^{2}} 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 VnV_{n}-test for n=10n=10

Kuiper [1] also presented a table of vnα,cnα\left\langle{v^{\alpha}_{n}},{c^{\alpha}_{n}}\right\rangle for n=10n=10 and cnα{1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9}c^{\alpha}_{n}\in\left\{1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9\right\}. Our programs also give similar numerical results, as shown in Table 3.

Table 3: Kuiper pair vnα,cnα\left\langle{v^{\alpha}_{n}},{c^{\alpha}_{n}}\right\rangle for n=10n=10.
Critical value Upper Tail Quantile Upper tail probability
cnαc^{\alpha}_{n} vnα=cnα/nv^{\alpha}_{n}=c^{\alpha}_{n}/\sqrt{n} α=Pr{nVn>cnα}\alpha=\Pr\left\{\sqrt{n}\cdot V_{n}>c^{\alpha}_{n}\right\}
1.001.00 0.31630.3163 0.69300.6930
1.101.10 0.34820.3482 0.52800.5280
1.201.20 0.37950.3795 0.37700.3770
1.301.30 0.41100.4110 0.25200.2520
1.401.40 0.44270.4427 0.15800.1580
1.501.50 0.47460.4746 0.09300.0930
1.601.60 0.50600.5060 0.05200.0520
1.701.70 0.53820.5382 0.02700.0270
1.801.80 0.56920.5692 0.01350.0135
1.901.90 0.60060.6006 0.00630.0063

5.3 Special case of Sufficiently Large Number of Samples

If the number of samples is large enough, we can let nn approach to infinity. Therefore,

{A1(c,)=2+8c2A2(c,)=2+32c2𝒜α(f,c)=ln[2+8c2+(2+32c2)e6c2]lnα2\begin{cases}A_{1}(c,\infty)=-2+8c^{2}\\ A_{2}(c,\infty)=-2+32c^{2}\\ \mathcal{A}^{\alpha}_{\infty}(f,c)=\sqrt{\frac{\ln\left[-2+8c^{2}+(-2+32c^{2})\mathrm{e}^{-6c^{2}}\right]-\ln\alpha}{2}}\end{cases} (46)

The Kuiper’s critical value is the fixed-point of

c=𝒜α(f,c).c=\mathcal{A}^{\alpha}_{\infty}(f,c). (47)

We start the iterative procedure with initial value cguess=1.2{c}_{\mathrm{guess}}=1.2 and set n=108n=10^{8}, and provide the cαc^{\alpha}_{\infty} for typical values of α\alpha in Table 4, which also coincides with Kuiper’s original results for α{0.1,0.05,0.01}\alpha\in\left\{0.1,0.05,0.01\right\} very well but our results illustrate more possible values of α\alpha.

Table 4: Kuiper’s critical value for nn\to\infty (e.g., we can set n=108n=10^{8} in computer program)
α\alpha 0.100.10 0.090.09 0.080.08 0.070.07 0.060.06 0.050.05 0.040.04 0.030.03 0.020.02 10210^{-2} 10610^{-6} 101010^{-10}
cαc^{\alpha}_{\infty} 1.61961.6196 1.64001.6400 1.66231.6623 1.68711.6871 1.71501.7150 1.74721.7472 1.78551.7855 1.83311.8331 1.89741.8974 2.00092.0009 3.00563.0056 3.72263.7226

5.4 Kuiper pair for Kuiper’s Vn,nV_{n,n}-test

Table 5 demonstrates the Kuiper pair for α{0.01,0.02,,0.10}\alpha\in\left\{0.01,0.02,\cdots,0.10\right\} and n{10,20,30,40,100,108}n\in\left\{10,20,30,40,100,10^{8}\right\} with the help of the procedure KuiperPairSolver in Algorithm 4.3. We remark that the corresponding values for α\alpha proposed by Kuiper [1] is α{0.10,0.05,0.01}\alpha\in\left\{0.10,0.05,0.01\right\} and the values of vn,nαv^{\alpha}_{n,n} is not listed.

Table 5: Kuiper pair for Kuiper’s Vn,nV_{n,n}-test where α=Pr{nVn,n>cn,nα}=Pr{Vn,n>vn,nα}\alpha=\Pr\left\{\sqrt{n}\cdot V_{n,n}>c^{\alpha}_{n,n}\right\}=\Pr\left\{V_{n,n}>v^{\alpha}_{n,n}\right\}
α\alpha nn (cn,nα,vn,nα)(c^{\alpha}_{n,n},v^{\alpha}_{n,n}) 1010 2020 3030 4040 100100 10810^{8}
0.100.10 (2.2431,0.7093)(2.2431,0.7093) (2.2660,0.5067)(2.2660,0.5067) (2.2740,0.4152)(2.2740,0.4152) (2.2780,0.3602)(2.2780,0.3602) (2.2854,0.2285)(2.2854,0.2285) (2.2905,0.0002)(2.2905,0.0002)
0.090.09 (2.2682,0.7173)(2.2682,0.7173) (2.2929,0.5127)(2.2929,0.5127) (2.3015,0.4202)(2.3015,0.4202) (2.3058,0.3646)(2.3058,0.3646) (2.3139,0.2314)(2.3139,0.2314) (2.3193,0.0002)(2.3193,0.0002)
0.080.08 (2.2953,0.7258)(2.2953,0.7258) (2.3220,0.5192)(2.3220,0.5192) (2.3314,0.4257)(2.3314,0.4257) (2.3362,0.3694)(2.3362,0.3694) (2.3449,0.2345)(2.3449,0.2345) (2.3509,0.0002)(2.3509,0.0002)
0.070.07 (2.3248,0.7352)(2.3248,0.7352) (2.3540,0.5264)(2.3540,0.5264) (2.3643,0.4317)(2.3643,0.4317) (2.3696,0.3747)(2.3696,0.3747) (2.3793,0.2379)(2.3793,0.2379) (2.3860,0.0002)(2.3860,0.0002)
0.060.06 (2.3572,0.7454)(2.3572,0.7454) (2.3896,0.5343)(2.3896,0.5343) (2.4011,0.4384)(2.4011,0.4384) (2.4070,0.3806)(2.4070,0.3806) (2.4180,0.2418)(2.4180,0.2418) (2.4255,0.0002)(2.4255,0.0002)
0.050.05 (2.3933,0.7568)(2.3933,0.7568) (2.4298,0.5433)(2.4298,0.5433) (2.4430,0.4460)(2.4430,0.4460) (2.4497,0.3873)(2.4497,0.3873) (2.4623,0.2462)(2.4623,0.2462) (2.4710,0.0002)(2.4710,0.0002)
0.040.04 (2.4343,0.7698)(2.4343,0.7698) (2.4764,0.5537)(2.4764,0.5537) (2.4918,0.4549)(2.4918,0.4549) (2.4998,0.3952)(2.4998,0.3952) (2.5147,0.2515)(2.5147,0.2515) (2.5251,0.0003)(2.5251,0.0003)
0.030.03 (2.4819,0.7849)(2.4819,0.7849) (2.5321,0.5662)(2.5321,0.5662) (2.5508,0.4657)(2.5508,0.4657) (2.5607,0.4049)(2.5607,0.4049) (2.5793,0.2579)(2.5793,0.2579) (2.5924,0.0003)(2.5924,0.0003)
0.020.02 (2.5393,0.8030)(2.5393,0.8030) (2.6021,0.5819)(2.6021,0.5819) (2.6266,0.4796)(2.6266,0.4796) (2.6397,0.4174)(2.6397,0.4174) (2.6650,0.2665)(2.6650,0.2665) (2.6834,0.0003)(2.6834,0.0003)
0.010.01 (2.6124,0.8261)(2.6124,0.8261) (2.6986,0.6034)(2.6986,0.6034) (2.7351,0.4994)(2.7351,0.4994) (2.7556,0.4357)(2.7556,0.4357) (2.7973,0.2797)(2.7973,0.2797) (2.8297,0.0003)(2.8297,0.0003)

5.5 Cumulative Distribution Function for Kuiper’s VnV_{n}-test

With the help of (6) and Algorithm 4.4, we can compute the x=FVn1(y)x=F^{-1}_{V_{n}}(y) by calling the procedure KuiperInvCDF as follows

xiKuiperInvCDF(yi,n),i=1,2,,isizex_{i}\leftarrow\textsc{KuiperInvCDF}(y_{i},n),\quad i=1,2,\cdots,{i}_{\mathrm{size}} (48)

Thus for each capacity nn of the random samples {Xt:1tn}\left\{X_{t}:1\leq t\leq n\right\} and probability sequence

{yi=FVn(xi):1iisize},\left\{y_{i}=F_{V_{n}}(x_{i}):1\leq i\leq{i}_{\mathrm{size}}\right\},

we can draw the curve of CDF with the pairs {(xi,yi):1iisize}\left\{(x_{i},y_{i}):1\leq i\leq{i}_{\mathrm{size}}\right\} such that yi=Pr{Vnxi}=FVn(xi)y_{i}=\Pr\left\{V_{n}\leq x_{i}\right\}=F_{V_{n}}(x_{i}).

Figure 5 illustrates the CDF of VnV_{n} statistic for various sample capacity nn. It is obvious that with the increasing of nn, the curve of CDF becomes more and more steep, which coincides with (7). Moreover, the horizontal line p=FVn(v)=0.05p=F_{V_{n}}(v)=0.05 shows the upper tail probability α=1p=0.05\alpha=1-p=0.05. The intersection points of the line with the CDF are the upper tail quantile vnαv^{\alpha}_{n} for α=0.05\alpha=0.05 where n{5,10,30,50,100,180,1000}n\in\left\{5,10,30,50,100,180,1000\right\}.

Refer to caption
Figure 5: CDF of VnV_{n}-statistic for various sample capacity nn

We remark that there are three equivalent ways for computing the inverse of CDF. Actually, we have

x\displaystyle x =FVn1(y)\displaystyle=F_{V_{n}}^{-1}(y) (49)
=KuiperInvCDF(y,n)\displaystyle=\textsc{KuiperInvCDF}(y,n)
=KuiperLTQ(y,n)\displaystyle=\textsc{KuiperLTQ}(y,n)
=KuiperUTQ(1y,n)\displaystyle=\textsc{KuiperUTQ}(1-y,n)

for ant y[0,1]y\in[0,1].

6 Discussion

6.1 An Alternative Choice of Non-linear Function for VnV_{n}-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 cc

f^nlm1(c,α,n)=A1(c,n)e2c2+A2(c,n)e8c2α=0fnlm1(c,α,n)=0{\hat{f}}_{\mathrm{nlm1}}(c,\alpha,n)=A_{1}(c,n)\cdot\mathrm{e}^{-2c^{2}}+A_{2}(c,n)\mathrm{e}^{-8c^{2}}-\alpha=0\Longleftrightarrow{f}_{\mathrm{nlm1}}(c,\alpha,n)=0 (50)

then for the fixed α\alpha and nn the function f^nlm1(c,α,n){\hat{f}}_{\mathrm{nlm1}}(c,\alpha,n) will have a flat region where the derivative f^nlm(c,α,n)=df^nlm1(c,α,n)/dc{\hat{f}}_{\mathrm{nlm}}^{\prime}(c,\alpha,n)=\operatorname{d}{\hat{f}}_{\mathrm{nlm1}}(c,\alpha,n)/\operatorname{d}c will be near zero, thus the Newton’s iterative method may fail if the initial value cguess{c}_{\mathrm{guess}} is larger than the root. Figure 6 demonstrates this situation clearly in which for c>cnαc>c^{\alpha}_{n} the curve of f^nlm1(c,α,n){\hat{f}}_{\mathrm{nlm1}}(c,\alpha,n) is very flat.

Refer to caption
Figure 6: Curve and root of f^nlm1(c,α,n){\hat{f}}_{\mathrm{nlm1}}(c,\alpha,n) for α{0.10,0.05,0.02,0.01}\alpha\in\left\{0.10,0.05,0.02,0.01\right\} and n=30n=30 in Kuiper’s VnV_{n}-test.

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 VnV_{n}-test, we can set: cguess(0.5,2.5){c}_{\mathrm{guess}}\in(0.5,2.5) for the direct iterative method based on 𝒜nα\mathcal{A}^{\alpha}_{n} and cguess(1.1,2.5){c}_{\mathrm{guess}}\in(1.1,2.5) for the Newton’s iterative method based on nα\mathcal{B}^{\alpha}_{n};

  • fort the Vn,nV_{n,n}-test, we can set: cguess(2.4,2.6){c}_{\mathrm{guess}}\in(2.4,2.6) for the direct iterative method based on 𝒜n,nα\mathcal{A}^{\alpha}_{n,n} and cguess(2.2,2.6){c}_{\mathrm{guess}}\in(2.2,2.6) for the Newton’s iterative method based on n,nα\mathcal{B}^{\alpha}_{n,n}.

In summary, if we set cguess[2.4,2.5]{c}_{\mathrm{guess}}\in[2.4,2.5], then the algorithms proposed could work well for both VnV_{n}-test and Vn,nV_{n,n}-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 𝒪(n1)\mathcal{O}\left(n^{-1}\right). Thus for small nn, the numerical precision is not high. Although Stephens [2] proposed the modified statistic Tn=(n+0.155+0.24/n)VnT_{n}=(\sqrt{n}+0.155+0.24/\sqrt{n})V_{n} for replacing the VnV_{n} for small nn, the bound of approximation error is not discussed. Essentially, what we need is a more precise formula for (9) with smaller approximation error, say 𝒪(n2)\mathcal{O}\left(n^{-2}\right) or 𝒪(n3)\mathcal{O}\left(n^{-3}\right), instead of using TnT_{n} 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 α=Pr{Kn>c}=Pr{nVn>c}\alpha=\Pr\left\{K_{n}>c\right\}=\Pr\left\{\sqrt{n}V_{n}>c\right\} which involves two infinite series by iterative method for Kuiper’s statistic VnV_{n} or Vn,nV_{n,n}. The Kuiper’s pair cα,vα\left\langle{c^{\alpha}_{\star}},{v^{\alpha}_{\star}}\right\rangle can be solved with the following steps:

  • (1)

    simplifying the nonlinear equation α=Pr{nV>c}\alpha=\Pr\left\{\sqrt{n}\cdot V_{\star}>c\right\} with second order approximation for V{Vn,Vn,n}V_{\star}\in\left\{V_{n},V_{n,n}\right\} in the asymptotic expansion;

  • (2)

    converting the nonlinear equation to a fixed-point equation with the form c=T(f,c,α,n)c=T(f,c,\alpha,n) by setting the updating operator TT, the function object f(c,α,n)f(c,\alpha,n) and initial value cguess{c}_{\mathrm{guess}} properly via the direct iterative scheme ci+1=𝒜α(c)=f(ci,α,n)c_{i+1}=\mathcal{A}^{\alpha}_{\star}(c)=f(c_{i},\alpha,n) or the Newton’s scheme ci+1=α(f,c)=cif(ci,α,n)/fc(ci,α,n)c_{i+1}=\mathcal{B}^{\alpha}_{\star}(f,c)=c_{i}-f(c_{i},\alpha,n)/f^{\prime}_{c}(c_{i},\alpha,n);

  • (3)

    designing algorithms for solving the fixed-point equation in order to compute the critical value cαc^{\alpha}_{\star} and the upper tail quantile vαv^{\alpha}_{\star};

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 VnV_{n}-test and Vn,nV_{n,n}-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, χ2\chi^{2}-test and normal test since the difference behind these different tests lies in the concrete form of the nonlinear equation α=Pr{Z>z}\alpha=\Pr\left\{Z>z\right\} for the given upper tail significance level α\alpha and the CDF FZ()F_{Z}(\cdot) encountered for the population ZZ and random samples {Zt:1tn}\left\{Z_{t}:1\leq t\leq n\right\}.

Our verification and validation shows that there is a mistake in Kuiper’s table of critical value cnαc^{\alpha}_{n} for (α,n)=(0.01,30)(\alpha,n)=(0.01,30). The correct value for c300.01c^{0.01}_{30} should be 1.92521.9252 or 1.92531.9253 instead of 1.91531.9153. 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.