| A | 1 | 4 | 6 | 7 | 8 | 9 |
| B | 1 | 4 | 6 | 7 | 8 | 39 |
| rank(A) | 1 | 2 | 3 | 4 | 5 | 6 |
| rank(B) | 1 | 2 | 3 | 4 | 5 | 6 |
University of Amsterdam
20 October 2026
In this lecture we aim to:
Reading: Chapter 15 (§15.1–15.9)
I’m Ken Griffey on the Mariners
Okay, I’m way beyond the boundaries, outside of parameters
The rap chancellor, jacket made of camel fur
Mac Miller, Apparition (Faces)
| Attribute | Parametric | Nonparametric |
|---|---|---|
| distribution | normally distributed | any distribution |
| sampling | random sample | random sample |
| sensitivity to outliers | yes | no |
| works with | large data sets | small and large data sets |
| speed | fast | slow |
| A | 1 | 4 | 6 | 7 | 8 | 9 |
| B | 1 | 4 | 6 | 7 | 8 | 39 |
| rank(A) | 1 | 2 | 3 | 4 | 5 | 6 |
| rank(B) | 1 | 2 | 3 | 4 | 5 | 6 |
| index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| x | 11 | 42 | 42 | 62 | 73 | 73 | 84 | 84 | 84 |
| ranks | 1 | 2.5 | 2.5 | 4 | 5.5 | 5.5 | 8 | 8 | 8 |
\[\frac{2 + 3}{2} = 2.5, \frac{5 + 6}{2} = 5.5, \frac{7 + 8 + 9}{3} = 8\]
| Test | \(H_0\) |
|---|---|
| Wilcoxon rank-sum (Mann-Whitney) | Both groups come from the same population distribution |
| Wilcoxon signed-rank | Positive and negative differences are equally likely (symmetric around 0) |
| Kruskal-Wallis | All groups come from the same population distribution |
| Friedman’s ANOVA | Within each participant, every order of the conditions is equally likely |
Independent 2 samples
Also known as the Mann-Whitney U test
Developed by Frank Wilcoxon the rank-sum test is an nonparametric alternative to the independent samples t-test.
By ranking all values and then summing the ranks per group, one would expect under the null hypothesis, that the sum of ranks is approximately equal.
After standardizing the test statistic (summed ranks for one group), we can use the standard normal distribution as the sampling distribution.
Data (.jasp) · Results (.jasp) · Results (.html)
Sunday BDI, independent \(t\)-test in JASP: Assumption Checks → Q-Q plot residuals → Confidence interval1
More on this in the extra text on skewed data (Student, Welch or Mann-Whitney?)

Drug rankedBDI
1 Alcohol 90.5
2 Ecstasy 119.5
We can take the sum of ranks for the first group as W:
JASP reports the value of U, which is W with its minimum value subtracted:
To calculate the Z-score we need to standardize the W. To do so we need the mean W and the standard error of W.
For this we need the sample sizes for each group.
\[\bar{W}_s=\frac{n_1(n_1+n_2+1)}{2}\]
\[{SE}_{\bar{W}_s}=\sqrt{ \frac{n_1 n_2 (n_1+n_2+1)}{12} }\]
\[z = \frac{W - \bar{W}}{{SE}_W}\]
Which looks a lot like
\[\frac{X - \bar{X}}{{SE}_X} \text{or} \frac{b - \mu_{b}}{{SE}_b} \]
JASP: U = 64.5, p = .286, a bit higher because of a continuity correction (Jane Superbrain 15.2)
\[r_{bs} = 1 - \frac{2*W}{n_1*n_2}\]
Paired 2 samples
The Wilcoxon signed-rank test is a nonparametric alternative to the paired samples t-test. It assigns + or - signs to the difference between two repeated measures. By ranking the absolute differences and summing these ranks for the positive group, the null hypothesis is tested that positive and negative differences are equally likely.
Data (.jasp) · Results (.jasp) · Results (.html)
Paired samples \(t\)-test in JASP: Assumption Checks → Q-Q plot residuals → Confidence interval
# Calculate difference in scores between second and first measure (as in the book)
data$diff = data$Wednesday - data$Sunday
# Calculate absolute difference in scores between second and first measure
data$abs.diff = abs(data$Wednesday - data$Sunday)
# Remove observations where the difference is 0
data <- data[data$diff != 0, ]
# Create rank variable
data$rank <- rank(data$abs.diff)
# Assign a '+' or a '-' to those values
data$sign <- sign(data$Wednesday - data$Sunday)Data (.jasp) · Results (.jasp) · Results (.html)
[1] 36
[1] 8
How likely is it to observe the highest possible rank sum (36), for \(n=8\), if there is no difference in BDI between Sunday and Wednesday?
\[\bar{T} = \frac{n(n+1)}{4}\]
T_mean is the middle point between the minimum (0) and maximum possible (36) value for T
\[{SE}_{T} = \sqrt{\frac{n(n+1)(2n+1)}{24}}\]
\[z = \frac{T_+ - \bar{T}}{{SE}_T}\]
JASP: W = 36, p = .014, a bit higher because of a continuity correction (Jane Superbrain 15.2)
\[r = \frac{T_+ - T_- }{T_+ + T_-}\]
Here \(T_+\) is the sum of the positive ranks (i.e., where Wednesday > Sunday), which is 36. \(T_-\) is the sum of the negative ranks, which do not exist. We have a maximum positive correlation (i.e., everybody with a difference scored higher on Wednesday).
Independent >2 samples
Created by William Henry Kruskal and Wilson Allen Wallis, the Kruskal-Wallis test is a nonparametric alternative to the independent one-way ANOVA.
The Kruskal-Wallis test essentially subtracts the expected mean ranking from each observed mean ranking, which is \(\chi^2\) distributed.
Data (.jasp) · Results (.jasp) · Results (.html)
One-way ANOVA in JASP (as in the book, Figure 15.10)
\[H = \frac{12}{N(N+1)} \sum_{i=1}^k \frac{R_i^2}{n_i} - 3(N+1)\]
\[H = \frac{12}{N(N+1)} \sum_{i=1}^k \frac{R_i^2}{n_i} - 3(N+1)\]
And the degrees of freedom
The \(\chi^2\) distribution describes the test statistic under the assumption of \(H_0\), given the degrees of freedom.
Paired >2 samples
Created by Milton Friedman the Friedman’s ANOVA is a nonparametric alternative to the repeated one-way ANOVA.
Just like the Kruskal-Wallis test, Friedman’s ANOVA, subtracts the expected mean ranking from the calculated observed mean ranking, which is also \(\chi^2\) distributed.
Data (.jasp) · Results (.jasp) · Results (.html)
Repeated measures ANOVA in JASP (as in the book, Figure 15.13)
Rank within each participant (i.e., within each row).
\[F_r = \left[ \frac{12}{Nk(k+1)} \sum_{i=1}^k R_i^2 \right] - 3N(k+1)\]
–> We sum the ranks for each of the three experimental conditions (and apply some standardizations).
Calculate ranks sum per condition and \(N\).
Start_R Month1_R Month2_R
19 20 21
\[ \frac{(k-1) \sum_i^k (R_i - \frac{b(k+1))}{2})^2}{\sum_i^b \sum_j^k (R_{ij}^2) - \frac{bk(k+1)^2}{4}} \]
k <- 3
b <- 10
F.r <- (sum ((R.i - ((b*(k+1))/2) )^2) * (k-1)) / (sum((ranks^2)) - (b*k *(k+1)^2) / 4)
F.r[1] 0.2
And the degrees of freedom
Accidents in a driving simulator, for every combination of alcohol and speed
pp, participant numberDaytime, morning or eveningnone_alc_none_speed to much_alc_much_speed, accidents in each of the 9 combinationsThe same pre- and posttest scores, analyzed in two ways
idy, id and time-point, long format (one row per measurement)pre-test, post-test and diff-scores, wide format (one row per participant)| Analysis | Also assumes | If unequal variances or no sphericity | If non-normal |
|---|---|---|---|
| Paired \(t\)-test | – | – | Wilcoxon signed-rank |
| Independent \(t\)-test | Equal variances | Welch \(t\) | Mann-Whitney |
| One-way ANOVA | Equal variances | Welch \(F\) | Kruskal-Wallis |
| Factorial ANOVA | Equal variances | – | – |
| ANCOVA | Equal variances, independent covariate, equal slopes | – | – |
| RM ANOVA | Sphericity (3+ levels) | Greenhouse-Geisser | Friedman (one-way only) |
| Mixed ANOVA | Equal variances, sphericity | Greenhouse-Geisser | – |
What you should know: how to assess, robust alternatives, and why these assumptions matter
Matthews et al. (2007): Having a quail of a time?
Do males fertilize more eggs when mating in the context that signalled a mating opportunity?
signalled: eggs fertilized in the male’s signalled contextcontrol: eggs fertilized in the male’s control contextÇetinkaya & Domjan (2006): Eggs-traordinary
Do fetishistic quail fertilize more eggs and initiate sex more quickly?
groups: fetishistic, non-fetishistic or controlegg_percent: percentage of eggs fertilizedlatency: time taken to initiate copulation
Scientific & Statistical Reasoning