3.1 Ranks
The ranks of observations play an important role in non-parametric methods. The rank of the \(i^{th}\) observation \(X_i\), in a sample of \(m\) observations, is equal to the number of observations that are less than or equal to \(X_i\). In other words, using the indicator function given as \begin {align*} \text {rank}(X_i) &=\sum ^m_{j=1}I(X_j\leq X_i)\\ &=mS_m(XS_i) \end {align*}
where \(S_m(X_i)\) is the edf of the sample i.e \[S_m(X)=\frac {\text {number of sample values}}{M}\leq X\]
\[ S_m(x)= \begin {cases} 0, &\text {if}\hspace {0.3cm} x\leq X_{(i)}\\ \dfrac {1}{M} & X_{(i-1)}\leq x\leq X_{(i)},\hspace {0.3cm} i=1,\dots ,m\\ 1, &x\geq X_{(n)}\\ \end {cases} \] for the ordered observations \(X_{(i)}\) the rank is simply equal to the index \(i\).
\[\text {rank}(X_{(i)})=\sum ^m_{j=1}I(X_j\leq X_{(i)})=mS_m(X_{(i)})=i.\]
When there are two samples i.e \(m\) \(X's\) and \(n\) \(Y's\) the rank of an observation is defined with respect to the
combined sample of \((m+n)\) observations say \(z's\).
Proof. Write the sum forwards and backwards and add the two rows term by term:
| \(1\) | \(2\) | \(3\) | \(\cdots \) | \(n-2\) | \(n-1\) | \(n\) |
| \(n\) | \(n-1\) | \(n-2\) | \(\cdots \) | \(3\) | \(2\) | \(1\) |
| \(n+1\) | \(n+1\) | \(n+1\) | \(\cdots \) | \(n+1\) | \(n+1\) | \(n+1\) |
Every column sums to \(n+1\) and there are \(n\) columns, so twice the required sum is \(n(n+1)\), giving \[2\sum ^{n}_{i=1}i=n(n+1)\hspace {0.6cm}\Longrightarrow \hspace {0.6cm} \sum ^{n}_{i=1}i=\dfrac {n(n+1)}{2}.\] □
Note 3.2. This small identity is used constantly in what follows. It gives the total of all ranks in a sample of \(n\), so that \(R_1+R_2=N(N+1)/2\) in the two-sample problem and the expected rank sum under \(H_0\) is \(n_1(N+1)/2\). Every rank test in these notes takes its mean from it.
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.