### 2.1 Distributions of the rank statistic in the shift case

Let {*X*_{1},…,*X*_{
m
}} and {*Y*_{1},…,*Y*_{
n
}} be two independent samples from the continuous cumulative density distributions *F*(*x*) and *G*(*x*−*θ*), respectively. Given *x*={*x*_{1},…,*x*_{
m
}} and *x*_{[i]} is the *i*^{th} smallest number in the sample, we have

{p}_{i}=P\left({x}_{[i-1]}<Y<{x}_{\left[i\right]}\right)={\int}_{{x}_{[i-1]}}^{{x}_{\left[i\right]}}g\left(y\right)\mathit{\text{dy}}=G\left({x}_{\left[i\right]}\right)-G\left({x}_{[i-1]}\right),

for *i*=1,2,…,*m*+1 where *x*_{[0]}=−*∞* and *x*_{[m+1]}=*∞*. Therefore, we define the sampling distribution of *Y* in the (*m*+1) intervals as

\begin{array}{lcr}\mathit{p}& =& \left(G\left({x}_{\left[1\right]}\right)-G\left({x}_{\left[0\right]}\right),\dots ,G\left({x}_{[m+1]}\right)-G\left({x}_{\left[m\right]}\right)\right)\hfill \\ =& \left({p}_{1},{p}_{2},\dots ,{p}_{m+1}\right).\hfill \end{array}

(3)

Given *m*, for *t*=1,2,…,*n*, let

\begin{array}{l}{\Omega}_{t}=\left\{{\mathit{u}}_{t}=\left({u}_{1}\right(t),\cdots \phantom{\rule{0.3em}{0ex}},{u}_{m+1}(t\left)\right):\sum _{i=1}^{m+1}{u}_{i}\left(t\right)=t\phantom{\rule{2.77626pt}{0ex}}\text{and}\phantom{\rule{2.77626pt}{0ex}}{u}_{i}\left(t\right)\ge 0,\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}i=1,\dots ,m+1\right\},\end{array}

where *u*_{
i
}(*t*) is the number of *y*^{′}*s* in the interval [ *x*_{[i−1]},*x*_{[i]}) among *y*_{1},…,*y*_{
t
}. For each *u*_{
n
}=(*u*_{1}(*n*),⋯,*u*_{m+1}(*n*)), we have a corresponding rank-sum of *y*’s in the combined sample

\begin{array}{l}{R}_{l}({\mathit{U}}_{n}={\mathit{u}}_{n}|\mathit{X})=\frac{\sum _{i=1}^{m+1}{u}_{i}^{2}\left(n\right)+\sum _{i=1}^{m+1}{u}_{i}\left(n\right)}{2}+\sum _{i=1}^{m}({u}_{i}\left(n\right)+1)\left(\sum _{j=i+1}^{m+1}{u}_{j}\left(n\right)\right).\end{array}

(4)

#### Theorem 1

*The statistic* *R*_{
l
}*is equivalent to the statistic* *W*_{
Y
}, *which is addressed by Wilcoxon in 1945.*

#### Proof

Let

I({x}_{i},{y}_{j})=\left\{\begin{array}{cc}1\phantom{\rule{1em}{0ex}}& \text{if}\phantom{\rule{0.3em}{0ex}}{x}_{i}<{y}_{j}\\ 0\phantom{\rule{1em}{0ex}}& \text{otherwise}.\end{array}\right.

The rank statistic *W*_{
Y
}, sum of the ranks of *y*’s observations, can be determined by

\begin{array}{lcr}\sum _{j=1}^{n}\left(\sum _{i=1}^{m}I({x}_{i},{y}_{j})+j\right)& =& \sum _{j=1}^{n}\sum _{i=1}^{m}I({x}_{i},{y}_{j})+\sum _{j=1}^{n}j\\ =& \sum _{i=1}^{m}\sum _{j=1}^{n}I({x}_{i},{y}_{j})+\frac{n(n+1)}{2}.\end{array}

(5)

The first summation of the first term in Equation (5) can be interpreted as the number of *y* observations larger than *x*_{[i]} which is \sum _{j=i+1}^{m+1}{u}_{j}\left(n\right) in our expression. It is not difficult to see that \sum _{i=1}^{m+1}{u}_{i}\left(n\right) equals *n*, the size of *y* sample. Therefore, the equation can be rewritten as

\begin{array}{l}\sum _{i=1}^{m}\left(\sum _{j=i+1}^{m+1}{u}_{j}\left(n\right)\right)+\frac{\sum _{i=1}^{m+1}{u}_{i}{\left(n\right)}^{2}+2\sum _{i=1}^{m}{u}_{i}\left(n\right)\left(\sum _{j=i+1}^{m+1}{u}_{j}\left(n\right)\right)+\sum _{i=1}^{m+1}{u}_{i}\left(n\right)}{2}.\end{array}

It is then easy to see that

\begin{array}{l}\sum _{i=1}^{m}\left({u}_{i}\right(n)+1)\left(\sum _{j=i+1}^{m+1}{u}_{j}\left(n\right)\right)+\frac{\sum _{i=1}^{m+1}{u}_{i}{\left(n\right)}^{2}+\sum _{i=1}^{m+1}{u}_{i}\left(n\right)}{2}={R}_{l}.\end{array}

Next, we demonstrate that for two random samples from the same population, the distribution of the random vector *U*_{
n
} is independent of the form of the distribution function.

#### Theorem 2

*Distribution-free property of* *U*_{
n
}.

\begin{array}{l}P\left({\mathit{U}}_{n}={\mathit{u}}_{n}|{H}_{o}\right)=\frac{1}{\mathit{\text{Card}}\left({\Omega}_{n}\right)}=\frac{1}{\left(\genfrac{}{}{0ex}{}{m+n}{n}\right)}.\end{array}

(6)

#### Proof

We know the joint PDF of the ordered sample of *x*^{′}*s* is given by

f\left({x}_{\left[1\right]},\dots ,{x}_{\left[m\right]}\right)=m!\phantom{\rule{2.77626pt}{0ex}}\prod _{i=1}^{m}f\left({x}_{i}\right)

and, when *F*=*G*, the conditional probability of the random vector *U*_{
n
} given *X*=(*x*_{1},*x*_{2},…,*x*_{
m
}) is

\begin{array}{l}P({\mathit{U}}_{n}={\mathit{u}}_{n}|\phantom{\rule{2.77626pt}{0ex}}{x}_{1},{x}_{2},\dots ,{x}_{m}\phantom{\rule{2.77626pt}{0ex}})=\frac{n!}{\prod _{i=1}^{m+1}{u}_{i}\left(n\right)!}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\prod _{i=1}^{m+1}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}{\left({\int}_{{x}_{[i-1]}}^{{x}_{\left[i\right]}}f\left(y\right)\mathit{\text{dy}}\right)}^{{u}_{i}\left(n\right)},\end{array}

(7)

where *x*_{[0]}=−*∞* and *x*_{[m+1]}=*∞*. By taking the expected value of the conditional probability, we have

\begin{array}{l}P({\mathit{U}}_{n}={\mathit{u}}_{n}|{H}_{o})\hfill \\ =\underset{-\infty \le {x}_{\left[1\right]}\le \cdots \le {x}_{\left[m\right]}\le \infty}{\int \cdots \int}P\left({\mathit{u}}_{n}\right|\phantom{\rule{2.77626pt}{0ex}}{x}_{1},\dots ,{x}_{m}\phantom{\rule{2.77626pt}{0ex}})\phantom{\rule{0.3em}{0ex}}f\left({x}_{\left[1\right]},\dots ,{x}_{\left[m\right]}\right)\phantom{\rule{2.77626pt}{0ex}}d{x}_{\left[1\right]}\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}}d{x}_{\left[m\right]}\hfill \\ ={\int}_{-\infty}^{\infty}{\int}_{{x}_{\left[1\right]}}^{\infty}\cdots {\int}_{{x}_{[m-1]}}^{\infty}\frac{n!}{\prod _{i=1}^{m+1}{u}_{i}\left(n\right)!}{\left(F\left({x}_{\left[1\right]}\right)\right)}^{{u}_{1}\left(n\right)}{\left(F\left({x}_{\left[2\right]}\right)-F\left({x}_{\left[1\right]}\right)\right)}^{{u}_{2}\left(n\right)}\hfill \\ \phantom{\rule{28.45274pt}{0ex}}\cdots {\left(1-F\left({x}_{\left[m\right]}\right)\right)}^{{u}_{m+1}\left(n\right)}m!\mathit{\text{dF}}\left({x}_{\left[1\right]}\right)\cdots \mathit{\text{dF}}\left({x}_{\left[m\right]}\right).\hfill \end{array}

(8)

Using variable transformation, it is clear to see that the random variables *F*(*x*_{[1]}),…,*F*(*x*_{[m]}) have a Dirichlet distribution with parameters *u*_{1}(*n*)+1,*u*_{2}(*n*)+1, …,*u*_{m+1}(*n*)+1. Therefore, we have

\begin{array}{l}P({\mathit{U}}_{n}={\mathit{u}}_{n}|{H}_{o})=\frac{n!m!}{(n+m)!}=\frac{1}{\mathit{\text{Card}}\left({\Omega}_{n}\right)}\end{array}

which is independent of the distribution function.

This is the reason that the distribution of the rank statistic *U*_{
n
} is distribution-free under the null hypothesis. However, the distribution of the random vector *U*_{
n
} is discrete uniform with the mass function one over the number of possible outcomes of the random vector *U*_{
n
} only when assuming *F*=*G*. In other words, the distribution of the random vector *U*_{
n
} can be found by the traditional combinatorial analysis when *F*=*G*. Unfortunately, when *F*≠*G*, we will not be able to establish the distribution of *U*_{
n
} through Equation (7) as solving the multiple integral in Equation (8) is either tedious given some appropriate alternative distribution function or difficult. Our understanding is that finding the power of the test has not been solved in most cases. To overcome this situation, we bring in the finite Markov chain imbedding approach.

Let *Ω*_{
t
},*t*=0,1,…,*n*, be the state space which has

\begin{array}{l}\left(\genfrac{}{}{0ex}{}{m+t}{t}\right)\end{array}

possible states, *Γ*_{
n
}={0,1,…,*n*} be an index set, and {*Z*_{
t
}:*t*∈*Γ*_{
n
}} be a non-homogeneous Markov chain on the state space *Ω*_{
t
}. As a transition probability matrix *M*_{
t
} for this chain, *t*=1,…,*n*, consider

\begin{array}{l}{\begin{array}{c}{\Omega}_{t}\\ {\mathit{M}}_{t}=\begin{array}{c}{\Omega}_{t-1}\end{array}& \left[\right.\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}{p}_{{u}_{t-1},{u}_{t}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\left]\right.\end{array}}_{\left(\genfrac{}{}{0ex}{}{m+t-1}{t-1}\right)\times \left(\genfrac{}{}{0ex}{}{m+t}{t}\right)},\end{array}

where

\begin{array}{lcr}{p}_{{\mathit{u}}_{t-1},{\mathit{u}}_{t}}\hfill & =& P({Z}_{t}={\mathit{u}}_{t}|{Z}_{t-1}={\mathit{u}}_{t-1})\hfill \\ =& \left\{\begin{array}{cc}{p}_{i}& \phantom{\rule{1em}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}{u}_{i}(t-1)+1={u}_{i}\left(t\right)\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{and}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}{u}_{j}(t-1)={u}_{j}\left(t\right)\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\forall \phantom{\rule{2.77626pt}{0ex}}j\ne i\\ 0& \phantom{\rule{1em}{0ex}}\text{otherwise}\hfill \end{array}\right.,\hfill \end{array}

and *p*_{
i
} is defined in Equation (3).

#### Theorem 3

*R*_{
l
}(*U*_{
n
}|*X*) *is finite Markov chain imbeddable, and*

\begin{array}{l}P\left({R}_{l}\right({\mathit{U}}_{n})=r|\mathit{X})=\mathit{\xi}\left(\prod _{t=1}^{n}{\mathit{M}}_{t}\right){\mathit{B}}^{\prime}({C}_{r}),\end{array}

*where*\mathit{B}\left({C}_{r}\right)=\sum _{k:{R}_{l}\left({\mathit{U}}_{n}\right)=r}{e}_{k},\phantom{\rule{2.83795pt}{0ex}}{e}_{k}*is a*1\times \left(\genfrac{}{}{0ex}{}{m+n}{n}\right)*unit row vector corresponding to state* *u*_{
n
}, *ξ*(=*P*(*Z*_{0}=1)=1) *is the initial probability and* *M*_{
t
}, *t*=1,…,*n*, *are the transition probability matrices of the imbedded Markov chain defined on the state space* *Ω*_{
t
}.

#### Proof

For each *u*_{
n
}=(*u*_{1}(*n*),⋯,*u*_{m+1}(*n*)) in the state space *Ω*_{
n
}, we have a corresponding rank *R*_{
l
} as shown in Equation (4). Intuitively, the minimum rank *r*_{
l
s
} is *n*(*n*+1)/2 and the maximum rank *r*_{
l
b
} is *n*(2*m*+*n*+1)/2. In accordance with the possible values of the rank *R*_{
l
}, we define a finite partition {*C*_{
r
}:*r*=*r*_{
l
s
},…,*r*_{
l
b
}} such that

\begin{array}{l}P({Z}_{n}\in {C}_{r}|\mathit{p})=\mathit{\xi}\left(\prod _{t=1}^{n}{\mathit{M}}_{t}\right){\mathit{B}}^{\prime}({C}_{r})\end{array}

(9)

where \mathit{B}\left({C}_{r}\right)=\sum _{k:{R}_{l}\left({\mathit{U}}_{n}\right)=r}{e}_{k},\phantom{\rule{2.77626pt}{0ex}}{e}_{k} is a 1\times \left(\genfrac{}{}{0ex}{}{m+n}{n}\right) unit row vector corresponding to state *U*_{
n
}, we then obtain the conditional probability of the rank *R*_{
l
}.

Then, the Law of Large Numbers is used to determine the probability of *U*_{
n
} for any continuous *F* and *G*

\frac{1}{N}\phantom{\rule{2.77626pt}{0ex}}\sum _{i=1}^{N}\phantom{\rule{2.77626pt}{0ex}}P({\mathit{U}}_{n}={\mathit{u}}_{n}|\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i}\left)\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\stackrel{\mathit{\text{p}}}{\to}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}P\right({\mathit{U}}_{n}={\mathit{u}}_{n})

where *X*_{
i
} is the *i*^{th} sample of size *m* from the distribution function *F*. It is easy to see that

\begin{array}{l}P\left({R}_{l}\right({\mathit{U}}_{n})=r)=\sum _{{\mathit{u}}_{n}:R\left({\mathit{u}}_{n}\right)=r}P({\mathit{U}}_{n}={\mathit{u}}_{n}).\end{array}

(10)

To test

{H}_{o}:F\left(x\right)=G\left(x\right)\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{versus}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}{H}_{a}:F\left(x\right)=G(x-\theta ),

for some *θ*≠0, the power function is approximated by

\begin{array}{l}P\left({R}_{l}\right({\mathit{U}}_{n})\le {r}_{1\alpha}|{H}_{a})+P({R}_{l}\left({\mathit{U}}_{n}\right)\ge {r}_{2\alpha}\left|{H}_{a}\right)\hfill \\ =& \sum _{r={r}_{\mathit{\text{ls}}}}^{{r}_{1\alpha}}P\left({R}_{l}\right({\mathit{U}}_{n})=r|{H}_{a})+\sum _{r={r}_{2\alpha}}^{{r}_{\mathit{\text{lb}}}}P({R}_{l}\left({\mathit{U}}_{n}\right)=r\left|{H}_{a}\right)\hfill \\ =& \sum _{r={r}_{\mathit{\text{ls}}}}^{{r}_{1\alpha}}\sum _{{\mathit{u}}_{n}:R\left({\mathit{u}}_{n}\right)=r}P({\mathit{U}}_{n}={\mathit{u}}_{n}|{H}_{a})+\sum _{r={r}_{2\alpha}}^{{r}_{\mathit{\text{lb}}}}\sum _{{\mathit{u}}_{n}:R\left({\mathit{u}}_{n}\right)=r}P({\mathit{U}}_{n}={\mathit{u}}_{n}\left|{H}_{a}\right)\hfill \\ \approx & \sum _{r={r}_{\mathit{\text{ls}}}}^{{r}_{1\alpha}}\sum _{{\mathit{u}}_{n}:R\left({\mathit{u}}_{n}\right)=r}\frac{1}{N}\phantom{\rule{2.77626pt}{0ex}}\sum _{i=1}^{N}\phantom{\rule{2.77626pt}{0ex}}P\left({\mathit{U}}_{n}\right|{H}_{a};\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i})+\sum _{r={r}_{2\alpha}}^{{r}_{\mathit{\text{lb}}}}\sum _{{\mathit{u}}_{n}:R\left({\mathit{u}}_{n}\right)=r}\frac{1}{N}\phantom{\rule{2.77626pt}{0ex}}\sum _{i=1}^{N}\phantom{\rule{2.77626pt}{0ex}}P({\mathit{U}}_{n}|{H}_{a};\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i})\hfill \\ =& \frac{1}{N}\phantom{\rule{2.77626pt}{0ex}}\left(\sum _{r={r}_{\mathit{\text{ls}}}}^{{r}_{1\alpha}}\sum _{i=1}^{N}\sum _{{\mathit{u}}_{n}:R\left({\mathit{u}}_{n}\right)=r}P\left({\mathit{U}}_{n}\right|{H}_{a};\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i})+\sum _{r={r}_{2\alpha}}^{{r}_{\mathit{\text{lb}}}}\sum _{i=1}^{N}\sum _{{\mathit{u}}_{n}:R\left({\mathit{u}}_{n}\right)=r}P({\mathit{U}}_{n}|{H}_{a};\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i})\right)\hfill \\ =& \frac{1}{N}\phantom{\rule{2.77626pt}{0ex}}\sum _{i=1}^{N}\phantom{\rule{2.77626pt}{0ex}}\left(\sum _{r={r}_{\mathit{\text{ls}}}}^{{r}_{1\alpha}}P\left({R}_{l}\right({\mathit{U}}_{n})=r|{H}_{a};\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i})+\sum _{r={r}_{2\alpha}}^{{r}_{\mathit{\text{lb}}}}P({R}_{l}\left({\mathit{U}}_{n}\right)=r|{H}_{a};\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i})\right),\hfill \end{array}

where

\begin{array}{l}P\left({R}_{l}\right({\mathit{U}}_{n})\le {r}_{1\alpha}|{H}_{o})+P({R}_{l}\left({\mathit{U}}_{n}\right)\ge {r}_{2\alpha}\left|{H}_{o}\right)\le \mathrm{\alpha .}\end{array}

Note that the alternative hypothesis is subject to the purpose of the test. This simply needs to be slightly modified if a one-sided test is adopted.

### 2.2 Distributions of the rank statistic in the scale case

We studied the distribution and the power function of the rank statistic *R*_{
l
} considering a shift in location. Now, the distribution and the power function of the rank statistic considering the scale parameter will be addressed. For this purpose, we consider *F*(*x*)=*G*(*x* *σ*^{−1}) and state the null and alternative hypotheses as

{H}_{o}:\sigma =1\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{versus}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}{H}_{a}:\sigma \ne 1.

To do so, we begin with the procedure of finding the distribution of the rank statistic, denoted *R*_{
s
}, considering the scale parameter through the random vector **U**_{
n
}. The array of ranks are given by

(m+n)/2,\dots ,3,2,1,\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}1,2,3,\dots ,(m+n)/2;

if *m*+*n* is even, and

(m+n-1)/2,\dots ,3,2,1,\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}0\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}1,2,3,\dots ,(m+n-1)/2

if *m*+*n* is odd. We first introduce how to determine the rank-sum of *y*^{′}*s* observations in the combined samples, *R*_{
s
}, with respect to

{\Omega}_{n}=\left\{{\mathbf{u}}_{n}=\left({u}_{1}\right(n),\dots ,{u}_{m+1}(n\left)\right):\sum _{i=1}^{m+1}{u}_{i}\left(n\right)=n\right\}

where *u*_{
i
}(*n*) means the number of *y* observations belonging to [ *x*_{[i−1]},*x*_{[i]}). Let *m* *e* *d*(*x*,*y*) be the median among *x*^{′}*s* and *y*^{′}*s* and belongs to [ *x*_{[i]},*x*_{[i+1]}) which will then break **U**_{
n
} into two parts {\mathit{U}}_{n}^{-} and {\mathit{U}}_{n}^{+}. If *m*+*n* is odd and *m* *e* *d*(*x*,*y*)=*x*_{[i]}, then

{\mathit{U}}_{n}^{-}=({u}_{1}^{-}={u}_{i}(n)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{2}^{-}={u}_{i-1}(n)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{i}^{-}={u}_{1}(n\left)\right)

is a 1×*i* vector and

{\mathit{U}}_{n}^{+}=\left({u}_{1}^{+}={u}_{i+1}\left(n\right)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{2}^{+}={u}_{i+2}\left(n\right)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{m+1-i}^{+}={u}_{m+1}\left(n\right)\right)

is a 1×(*m*+1−*i*) vector. The second possible case is, if *m*+*n* is odd and \mathit{\text{med}}(x,y)={y}_{\left[\sum _{k=1}^{i}{u}_{k}\left(n\right)+j\right]}, then {\mathit{U}}_{n}^{-}, a row vector with length *i*+1, has the form

\left({u}_{1}^{-}=j-1\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{2}^{-}={u}_{i}\left(n\right)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{i+1}^{-}={u}_{1}\left(n\right)\right)

and {\mathit{U}}_{n}^{+}, a row vector with length *m*+1−*i*, is given by

\left({u}_{1}^{+}={u}_{i+1}\left(n\right)-j\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{2}^{+}={u}_{i+2}\left(n\right)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{m+1-i}^{+}={u}_{m+1}\left(n\right)\right).

The third possible case is, if *m*+*n* is even and *x*_{[i]} is the smallest number larger than *m* *e* *d*(*x*,*y*), the vectors are now defined as

{\mathit{U}}_{n}^{-}=({u}_{1}^{-}={u}_{i}(n)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{2}^{-}={u}_{i-1}(n)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{i}^{-}={u}_{1}(n\left)\right)

and

{\mathit{U}}_{n}^{+}=\left({u}_{1}^{+}=0\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{2}^{+}={u}_{i+1}\left(n\right)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{m+2-i}^{+}={u}_{m+1}\left(n\right)\right).

The last possibility is, if *m*+*n* is even, {y}_{\left[\sum _{k=1}^{i}{u}_{k}\left(n\right)+j\right]} is the smallest number larger than *m* *e* *d*(*x*,*y*). The vectors are now defined as

{\mathit{U}}_{n}^{-}=({u}_{1}^{-}=j-1\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{2}^{-}={u}_{i}(n)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{i+1}^{-}={u}_{1}(n\left)\right)

and

{\mathit{U}}_{n}^{+}=\left({u}_{1}^{+}={u}_{i+1}\left(n\right)-j+1\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{2}^{+}={u}_{i+2}\left(n\right)\phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}\cdots \phantom{\rule{2.77626pt}{0ex}},\phantom{\rule{2.77626pt}{0ex}}{u}_{m+1-i}^{+}={u}_{m+1}\left(n\right)\right).

Let *n*^{−} be the length of the vector {\mathit{U}}_{n}^{-} and *n*^{+} be the length of the vector {\mathit{U}}_{n}^{+}.

#### Theorem 4

*R*_{
s
}(**U**_{
n
}|*X*) *is finite Markov chain imbeddable, and*

\begin{array}{l}P\left({R}_{s}\right({\mathbf{U}}_{n})=r|\mathit{X})=\mathit{\xi}\left(\prod _{t=1}^{n}{M}_{t}\right){\mathit{B}}^{\prime}({C}_{r}),\end{array}

*where*\mathit{B}\left({C}_{r}\right)=\sum _{k:{R}_{s}\left({\mathbf{U}}_{n}\right)=r}{e}_{k},\phantom{\rule{2.83795pt}{0ex}}{e}_{k}*is a*1\times \left(\genfrac{}{}{0ex}{}{m+n}{n}\right)*unit row vector corresponding to state* **U**_{
n
}, *ξ*(=*P*(*Z*_{0}=1)=1) *is the initial probability and* *M*_{
t
}, *t*=1,…,*n* *are the transition probability matrices of the imbedded Markov chain defined on the state space* *Ω*_{
t
}.

#### Proof

For each **U**_{
n
} in the state space *Ω*_{
n
}, we have a corresponding

\begin{array}{lcr}{R}_{s}\left({\mathbf{U}}_{n}\right|\mathit{X})& =& {R}_{s}\left({\mathit{U}}_{n}^{-}\right|\mathit{X})+{R}_{s}({\mathit{U}}_{n}^{+}\left|\mathit{X}\right)\hfill \\ =& \frac{\sum _{k=1}^{{n}^{-}}{\left({u}_{k}^{-}\right)}^{2}+\sum _{k=1}^{{n}^{-}}{u}_{k}^{-}}{2}+\sum _{k=1}^{{n}^{-}-1}\left({u}_{k}^{-}+1\right)\left(\sum _{j=k+1}^{{n}^{-}}{u}_{j}^{-}\right)\hfill \\ +\frac{\sum _{k=1}^{{n}^{+}}{\left({u}_{k}^{+}\right)}^{2}+\sum _{k=1}^{{n}^{+}}{u}_{k}^{+}}{2}+\sum _{k=1}^{{n}^{+}-1}\left({u}_{k}^{+}+1\right)\left(\sum _{j=k+1}^{{n}^{+}}{u}_{j}^{+}\right).\hfill \end{array}

(11)

The smallest possible value of *R*_{
s
}(**U**_{
n
}) is

\begin{array}{l}{r}_{\mathit{\text{ss}}}=\left\{\begin{array}{ll}\frac{n(n+2)}{4}\hfill & \phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}m+n\phantom{\rule{2.77626pt}{0ex}}\text{is even and}\phantom{\rule{2.77626pt}{0ex}}n\phantom{\rule{2.77626pt}{0ex}}\text{is even}\\ \frac{(n+1)(n+3)}{4}\hfill & \phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}m+n\phantom{\rule{2.77626pt}{0ex}}\text{is even and}\phantom{\rule{2.77626pt}{0ex}}n\phantom{\rule{2.77626pt}{0ex}}\text{is odd}\\ \frac{{n}^{2}}{4}\hfill & \phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}m+n\phantom{\rule{2.77626pt}{0ex}}\text{is odd and}\phantom{\rule{2.77626pt}{0ex}}n\phantom{\rule{2.77626pt}{0ex}}\text{is even}\\ \frac{(n+1)(n-1)}{4}\hfill & \phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}m+n\phantom{\rule{2.77626pt}{0ex}}\text{is odd and}\phantom{\rule{2.77626pt}{0ex}}n\phantom{\rule{2.77626pt}{0ex}}\text{is odd}\end{array}\right.\end{array}

(12)

and the largest possible value is

\begin{array}{l}{r}_{\mathit{\text{sb}}}=\left\{\begin{array}{ll}\frac{n(2m+n+2)}{4}\hfill & \phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}m+n\phantom{\rule{2.77626pt}{0ex}}\text{is even and}\phantom{\rule{2.77626pt}{0ex}}n\phantom{\rule{2.77626pt}{0ex}}\text{is even}\\ \frac{n(2m+n+2)-1}{4}\hfill & \phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}m+n\phantom{\rule{2.77626pt}{0ex}}\text{is even and}\phantom{\rule{2.77626pt}{0ex}}n\phantom{\rule{2.77626pt}{0ex}}\text{is odd}\\ \frac{n(2m+n-1)}{4}\hfill & \phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}m+n\phantom{\rule{2.77626pt}{0ex}}\text{is odd and}\phantom{\rule{2.77626pt}{0ex}}n\phantom{\rule{2.77626pt}{0ex}}\text{is even}\\ \frac{n(2m+n)-1}{4}\hfill & \phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{if}\phantom{\rule{2.77626pt}{0ex}}m+n\phantom{\rule{2.77626pt}{0ex}}\text{is odd and}\phantom{\rule{2.77626pt}{0ex}}n\phantom{\rule{2.77626pt}{0ex}}\text{is odd}\end{array}\right.\end{array}

(13)

In accordance with Equation (11), we use the possible value of *R*_{
s
} as a rule of the partition. The rest of the proof follows along the same line as that of Theorem 3, and here, is omitted.

Similarly, we apply the LLN to conclude that

\frac{1}{N}\phantom{\rule{2.77626pt}{0ex}}\sum _{i=1}^{N}\phantom{\rule{2.77626pt}{0ex}}P\left({R}_{s}\right|\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i}\phantom{\rule{2.77626pt}{0ex}}\left)\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\stackrel{\mathit{\text{p}}}{\to}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}P\right({R}_{s})

which establishes the distribution of *R*_{
s
}.

Through FMCI we, again, successfully retrieved the distribution of *R*_{
s
} under selected alternative distributions, for which the procedures are similar to those in the previous section. In addition, it is quite intuitive to approximate the power function by

\begin{array}{l}\frac{1}{N}\phantom{\rule{2.77626pt}{0ex}}\sum _{i=1}^{N}\left(\sum _{s={r}_{\mathit{\text{ss}}}}^{{s}_{1\alpha}}P\left({R}_{s}\right({\mathbf{U}}_{n})=s|\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i})+\sum _{s={s}_{2\alpha}}^{{r}_{\mathit{\text{sb}}}}P({R}_{s}\left({\mathbf{U}}_{n}\right)=s\left|\phantom{\rule{2.77626pt}{0ex}}{\mathbf{\text{X}}}_{i}\right)\right),\end{array}

where

\begin{array}{l}P\left({R}_{s}\right({\mathbf{U}}_{n})\le {s}_{1\alpha}|{H}_{o})+P({R}_{s}\left({\mathbf{U}}_{n}\right)\ge {s}_{2\alpha}\left|{H}_{o}\right)\le \mathrm{\alpha .}\end{array}

### 2.3 Joint distributions of the rank statistics in the shift and scale case

We have derived the marginal distributions of *R*_{
l
} and *R*_{
s
} in terms of *U*_{
n
}, respectively, which yield the following theorem.

#### Theorem 5

(*R*_{
l
}(*U*_{
n
}|*X*),*R*_{
s
}(*U*_{
n
}|*X*)) *is finite Markov chain imbeddable, and*

\begin{array}{l}P\left({R}_{l}\right({\mathit{U}}_{n})={r}_{1};{R}_{s}({\mathit{U}}_{n})={r}_{2}|\mathit{X})=\mathit{\xi}\left(\prod _{t=1}^{n}{\mathit{M}}_{t}\right){\mathit{B}}^{\prime}({C}_{r})\end{array}

*where*\mathit{B}\left({C}_{r}\right)=\sum _{k:{R}_{l}\left({\mathit{U}}_{n}\right)={r}_{1}\&{R}_{s}\left({\mathit{U}}_{n}\right)={r}_{2}}{e}_{k},\phantom{\rule{2.83795pt}{0ex}}{e}_{k}*is a*1\times \left(\genfrac{}{}{0ex}{}{m+n}{n}\right)*unit row vector corresponding to state* *u*_{
n
}, *ξ*(=*P*(*Z*_{0}=1)=1) *is the initial probability and* *M*_{
t
}, *t*=1,…,*n* are the transition probability matrices of the imbedded Markov chain defined on the state space *Ω*_{
t
}.

#### Proof

By Equations (4) and (11), we know each *u*_{
n
} in the state space *Ω*_{
n
} has corresponding values of *R*_{
l
} and *R*_{
s
}. The combinations of the values *R*_{
l
} and *R*_{
s
} are used to be the standard of the partition. The rest of the proof follows along the same line as that of Theorem 3.

The joint distribution of the ranks considering both the location and scale parameters which can be determined through our algorithm is yet to be studied in the literature. Our result allows us to test the homogeneity of the distribution functions *F*(*x*)=*G*((*x*−*θ*)*σ*^{−1}). We state the hypotheses as follows

\begin{array}{l}{H}_{o}:\theta =0\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{and}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\sigma =1\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{v.s.}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}{H}_{a}:\theta \ne 0\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{or}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\sigma \ne 1.\end{array}

(14)

Also we are able to identify a proper critical region under the null hypothesis and discuss its power when *F*≠*G*. For example, a rectangular critical region can be

\begin{array}{l}{C}_{\alpha}=\{{R}_{l}\le {r}_{1l},\phantom{\rule{2.77626pt}{0ex}}{R}_{l}\ge {r}_{2l},\phantom{\rule{2.77626pt}{0ex}}{R}_{s}\le {r}_{1s}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\text{or}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}\phantom{\rule{2.77626pt}{0ex}}{R}_{s}\ge {r}_{2s}\}\end{array}

where *r*_{1l}, *r*_{2l}, *r*_{1s} and *r*_{2s} are the critical values such that

\begin{array}{lcr}P({R}_{l}\le {r}_{1l}|{H}_{o})& +& P({R}_{l}\ge {r}_{2l}|{H}_{o})+P({r}_{1l}<{R}_{l}<{r}_{2l},{R}_{s}\le {r}_{1s}\left|{H}_{o}\right)\\ +& P({r}_{1l}<{R}_{l}<{r}_{2l},{R}_{s}\ge {r}_{2s}|{H}_{o})\le \alpha \hfill \end{array}

or an elliptic critical region

\begin{array}{l}{C}_{\alpha}^{\prime}=\left\{\frac{{R}_{l}^{2}}{a}+\frac{{R}_{s}^{2}}{b}>C\right\}\end{array}

for some positive constants *a* and *b* such that

\begin{array}{l}P\left(\frac{{R}_{l}^{2}}{a}+\frac{{R}_{s}^{2}}{b}>C|{H}_{o}\right)\le \mathrm{\alpha .}\end{array}

According to the above defined rejection region, the power of the test can be found as

\begin{array}{lcr}P({R}_{l}\le {r}_{1l}|{H}_{a})& +& P({R}_{l}\ge {r}_{2l}|{H}_{a})+P({r}_{1l}<{R}_{l}<{r}_{2l},{R}_{s}\le {r}_{1s}\left|{H}_{a}\right)\\ +& P({r}_{1l}<{R}_{l}<{r}_{2l},{R}_{s}\ge {r}_{2s}|{H}_{a})\hfill \end{array}

(15)

or

\begin{array}{l}P\left(\frac{{R}_{l}^{2}}{a}+\frac{{R}_{s}^{2}}{b}>C|{H}_{a}\right).\end{array}

(16)

Note that unless having a conjecture about the values of *θ* and *σ*, we tend to use a two-sided test. However, with the knowledge of the center and shape of the distribution of interest, deciding a sectorial critical region is a better choice, for which an example is demonstrated in the numerical studies.