Ranks
Rank tests start from rank-transformed data.
- Let \(Y_1, \ldots, Y_n\).
- In the absence of ties \[R_i=R(Y_i) = \#\{Y_j: Y_j\leq Y_i; j=1,\ldots, n\}\]
- Smallest observation has rank 1, second smallest rank 2, … , largest observation gets rank \(n\)
[1] 244 206 242 278 236 188 212 186 198 160
[1] 9 5 8 10 7 3 6 2 4 1
ties
Sometimes ties occur: two observations with identical values
withTies=c(403,507,507,610,651,651,651,830,900)
rank(withTies)
[1] 1.0 2.5 2.5 4.0 6.0 6.0 6.0 8.0 9.0
Ranks of pooled sample
- Let \(Y_{ij}\), \(i=1,\ldots, n_j\) be observations from two treatment groups \(j=1,2\).
- They can also be represened by \(Z_1,\ldots, Z_n\) (\(n=n_1+n_2\)), the outcomes of the pooled sample
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
group "1" "1" "1" "1" "1" "2" "2" "2" "2" "2"
cholest "244" "206" "242" "278" "236" "188" "212" "186" "198" "160"
[1] 244 206 242 278 236 188 212 186 198 160
[1] 9 5 8 10 7 3 6 2 4 1
Wilcoxon-Mann-Whitney Test
Simultaneously developed by Wilcoxon, and, Mann and Whitney: Wilcoxon-Mann-Whitney, Wilcoxon rank sum test or Mann-Whitney U test
hypotheses
Under \(H_0\) the distributions of the two groups are equal \[H_0: f_1=f_2\]
Under the alternative \(H_1\) the distributions differ in location \[H_1: \mu_1\neq \mu_2\]
\(H_1\) assumes location-shift, we will relax this assumption later on.
Test statistic
Classic T-test: difference in sample means \(\bar{Y}_1-\bar{Y}_2\).
Here: Difference in sample means based on rank transformed data
Ranks based on the poolde sample (upon joining the observations from the two groups): \(R_{ij}=R(Y_{ij})\) is de rank of observation \(Y_{ij}\) in the pooled sample.
\[
T = \frac{1}{n_1}\sum_{i=1}^{n_1} R(Y_{i1}) - \frac{1}{n_2}\sum_{i=1}^{n_2} R(Y_{i2}) .
\]
Under \(H_0\) we expect the average rank of the first group to be close to that of the second group so \(T\) is close to zero.
Under \(H_1\) we expect the mean ranks to differ so that \(T\) deviates from zero.
It is sufficient to only calculate \[S_1=\sum_{i=1}^{n_1} R(Y_{i1})\].
\(S_1\) is the sum of the ranks of the first group: rank sum test.
This holds because \[
S_1+S_2 = \text{sum of all ranks} = 1+2+\cdots + n=\frac{1}{2}n(n+1).
\]
\(S_1\) (or \(S_2\)) is a good test statistic
Use permutations to determine the exact permutation distribution. (Permute the ranks between the groups)
- For a given \(n\) and no ties the rank transformed data is always \[1, 2, \ldots, n\]
- For given \(n_1\) en \(n_2\) the permutation distribution is always the same!
With current computing power this is not so important any more.
Standardized statistic
Often the standardized test statistic is used \[
T = \frac{S_1-\text{E}_{0}\left[S_1\right]}{\sqrt{\text{Var}_{0}\left[S_1\right]}},
\]
with \(\text{E}_{0}\left[S_1\right]\) and \(\text{Var}_{0}\left[S_1\right]\) the expect mean and variance of S1 under \(H_0\).
Under \(H_0\) \[
\text{E}_{0}\left[S_1\right]= \frac{1}{2}n_1(n+1) \;\;\;\;\text{ en }\;\;\;\; \text{Var}_{0}\left[S_1\right]=\frac{1}{12}n_1n_2(n+1).
\]
Under \(H_0\) and when \(\min(n_1,n_2)\rightarrow \infty\) \[
T = \frac{S_1-\text{E}_{0}\left[S_1\right]}{\sqrt{\text{Var}_{0}\left[S_1\right]}} \rightarrow N(0,1).
\]
Asymptotically the standardised statistic follows a standard normal distribution!
Cholestorol example
We illustrate the result for the cholestorol example using the R function wilcox.test
.
wilcox.test(cholest~group,data=chol)
Wilcoxon rank sum test
data: cholest by group
W = 24, p-value = 0.01587
alternative hypothesis: true location shift is not equal to 0
S1 <- sum(rank(chol$cholest)[chol$group==1])
S1
[1] 39
S2 <- sum(rank(chol$cholest)[chol$group==2])
S2
[1] 16
- Where does \(W=\) 24 comes from?
Mann and Whitney test
Mann and Whitney test in absence of ties: \[
U_1 = \sum_{i=1}^{n_1}\sum_{k=1}^{n_2} \text{I}\left\{Y_{i1}\geq Y_{k2}\right\}.
\]
with \(\text{I}\left\{.\right\}\) an indicator that equals 1 if the expression is true and is zero otherwise.
U counts how many times an observation of the first group is larger or equal to an observation from the second group.
y1=subset(chol,group==1)$cholest
y2=subset(chol,group==2)$cholest
u1Hlp=sapply(y1,function(y1i,y2) {y1i>=y2},y2=y2)
colnames(u1Hlp)=y1;rownames(u1Hlp)=y2
244 206 242 278 236
188 TRUE TRUE TRUE TRUE TRUE
212 TRUE FALSE TRUE TRUE TRUE
186 TRUE TRUE TRUE TRUE TRUE
198 TRUE TRUE TRUE TRUE TRUE
160 TRUE TRUE TRUE TRUE TRUE
[1] 24
It can be shown that \(U_1 = S_1 - \frac{1}{2}n_1(n_1+1).\)
S1-nGroups[1]*(nGroups[1]+1)/2
1
24
- \(U_1\) en \(S_1\) contain the same information
- \(U_1\) is also a rankstatistiek, and
- Exact testen based on \(U_1\) and \(S_1\) are equivalent.
Probabilistic index
- \(U_1\) has a better interpretation feature
- Let \(Y_j\) a random observation from group \(j\) (\(j=1,2\)). Then
\[\begin{eqnarray*}
\frac{1}{n_1n_2}\text{E}\left[U_1\right]
&=& \text{P}\left[Y_1 \geq Y_2\right].
\end{eqnarray*}\]
So we can estimate the probability by calculating the mean of all indicator variable values \(\text{I}\left\{Y_{i1}\geq Y_{k2}\right\}\). Note, that we did \(n_1 \times n_2\) comparisons
[1] 0.96
U1/(nGroups[1]*nGroups[2])
1
0.96
wTest<-wilcox.test(cholest~group,data=chol)
wTest
Wilcoxon rank sum test
data: cholest by group
W = 24, p-value = 0.01587
alternative hypothesis: true location shift is not equal to 0
[1] 24
probInd=wTest$statistic/prod(nGroups)
probInd
W
0.96
Because \(p=\) 0.0159 \(<0.05\) we conclude at the \(5\%\) significance level that the mean cholestorol level of hartpatients is larger then that of healthy subjects.
- Note that we have assumed that the location-shift model is valid in this conclusion.
- We also know that higher cholestorol level are more likely for hartpatients then for healthy subjects and this probability is \(U1/(n_1\times n_2)=\) 96%.
- We should assess the location shift assumption. But this is not possible with only 5 observations.
Without the location-shift assumption the conclusion in terms of the probabilistic index remains valid!
- So when we do not assume location shift we test for
\[H_0: F_1=F_2 \text{ vs } H_1: P[Y_1 \geq Y_2] \neq 0.5.\]
Conclusion
There is a significant difference in the distribution of the cholestorol concentration of hartpatients two days upon a stroke and that of healthy subject ((\(p=\) 0.0159). It is more likely to observe higher cholestorol levels for hartpatients then for healthy subjects. The point estimator for this probability is 96%.
LS0tCnRpdGxlOiAiOS4gTm9ucGFyYW1ldHJpYyBTdGF0aXN0aWNzIC0gV2lsY294b24tTWFubi1XaXRobmV5IHRlc3QiICAKYXV0aG9yOiAiTGlldmVuIENsZW1lbnQiCmRhdGU6ICJzdGF0T21pY3MsIEdoZW50IFVuaXZlcnNpdHkgKGh0dHBzOi8vc3RhdG9taWNzLmdpdGh1Yi5pbykiCm91dHB1dDoKICAgIGh0bWxfZG9jdW1lbnQ6CiAgICAgIGNvZGVfZG93bmxvYWQ6IHRydWUgICAgCiAgICAgIHRoZW1lOiBjb3NtbwogICAgICB0b2M6IHRydWUKICAgICAgdG9jX2Zsb2F0OiB0cnVlCiAgICAgIGhpZ2hsaWdodDogdGFuZ28KICAgICAgbnVtYmVyX3NlY3Rpb25zOiB0cnVlCi0tLQoKYGBge3Igc2V0dXAsIGluY2x1ZGU9RkFMU0V9CmtuaXRyOjpvcHRzX2NodW5rJHNldChpbmNsdWRlID0gVFJVRSwgY29tbWVudCA9IE5BLCBlY2hvID0gVFJVRSwKICAgICAgICAgICAgICAgICAgICAgIG1lc3NhZ2UgPSBGQUxTRSwgd2FybmluZyA9IEZBTFNFKQpsaWJyYXJ5KHRpZHl2ZXJzZSkKbGlicmFyeShSbWlzYykKc2V0LnNlZWQoMTQwKQpgYGAKCgojSW50cm8KCkluZmVyZW5jZSB3YXMgb25seSBjb3JyZWN0IGlmIGRpc3RyaWJ1dGlvbmFsIGFzc3VtcHRpb25zIHdlcmUgc2F0aXNmaWVkIAoKLSBlLmcgTm9ybWFsIGRpc3RyaWJ1dGlvbiAKLSBlcXVhbCB2YXJpYW5jZSAKIAotICBUaGUg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