Why Measure Association by Ranks?
Pearson correlation describes linear association using the values of two variables. That can be useful for risk data, but it may be a poor summary when the relationship is curved or when observations are recorded on an ordered scale rather than a meaningful numerical scale. For example, a hypothetical insurer might record two risks by severity category—low, moderate, high, and very high. The ordering is informative, but the numerical gaps between categories are not necessarily equal.
A rank correlation replaces each observation with its position in the ordered sample. It therefore asks whether larger values of one variable tend to occur with larger values of the other, without requiring a straight-line relationship or meaningful distances between the original values. The measure developed here is Spearman’s rank correlation, also called Spearman’s rho.
When there are no tied observations in either variable, ranks are the integers \(1,\ldots,n\), with rank 1 assigned to the smallest observation. In that case, define \(d_i=R_i-S_i\). Spearman’s coefficient can be calculated directly as
This shortcut requires no ties. If observations are tied, assign tied observations their average rank and calculate the Pearson correlation of the rank pairs directly. The shortcut formula above is not valid with ties. The rank-based definition also requires an ordering of the observations; it does not require that the numerical differences between their original values have a useful interpretation.
Why the No-Ties Formula Works
The shortcut follows from writing the Pearson correlation of the ranks in terms of their squared differences. For ranks \(1,\ldots,n\), both rank variables have mean \((n+1)/2\), and their sum of squared deviations from that mean is \(n(n^2-1)/12\). Since both rank variables have the same sum of squared deviations, the Pearson correlation of the ranks is
The squared rank differences satisfy
Because each set of ranks is a permutation of \(1,\ldots,n\), \(\sum R_i^2=\sum S_i^2\). Also, expanding the rank covariance numerator gives \(\sum R_iS_i-n\bar R\bar S\). Substituting these identities and \(\bar R=\bar S=(n+1)/2\) into the Pearson expression yields
Thus the shortcut is not a separate measure: it is an algebraic form of the Pearson correlation applied to ranks. Ranking removes the original scale while retaining the ordering.
Worked Example: Comparing Two Ordinal Risk Assessments
A hypothetical risk committee orders five projects by operational-risk concern and separately by control weakness. The ordered scores have no ties, and the project ranks are as follows. Calculate Spearman’s rank correlation. The observations are fixed hypothetical rankings; no probability distribution, interest assumption, or mortality assumption is involved.
| Project | Operational concern rank \(R_i\) | Control weakness rank \(S_i\) | \(d_i=R_i-S_i\) | \(d_i^2\) |
|---|---|---|---|---|
| A | 1 | 2 | -1 | 1 |
| B | 2 | 1 | 1 | 1 |
| C | 3 | 4 | -1 | 1 |
| D | 4 | 3 | 1 | 1 |
| E | 5 | 5 | 0 | 0 |
Method. There are \(n=5\) paired ranks and no ties, so use the shortcut. The squared rank differences sum to \(1+1+1+1+0=4\). Therefore,
The rankings show a fairly strong positive monotone association: projects ranked higher for operational concern tend also to rank higher for control weakness. The rankings are not identical, so the coefficient is below 1. A common mistake is to treat ranks as if they were original measurements and interpret a one-rank difference as a fixed change in risk. Here, the result summarizes ordering, not the size of any underlying risk difference.
Nonlinear Relationships and the Pearson Comparison
A strictly increasing transformation preserves order. Consequently, if every \(Y_i\) is obtained from \(X_i\) by the same strictly increasing function, the two rank lists are identical and Spearman’s coefficient is 1, even if the relationship is strongly curved. A strictly decreasing transformation reverses the order, giving a coefficient of \(-1\) when there are no ties. Pearson correlation, in contrast, depends on the original numerical values and summarizes linear association.
Worked Example: A Strongly Curved Increasing Relationship
For six hypothetical paired portfolio indicators, suppose \(X\) takes values \(1,2,3,4,5,6\), and the corresponding \(Y\) values are \(1,2,4,8,16,32\). The pairs are fixed data, with no ties; no probability distribution is assumed. Calculate both correlations and compare them.
Step 1: Rank the observations. Each variable is strictly increasing across the six pairs. Thus the rank lists are both \(1,2,3,4,5,6\), every \(d_i=0\), and
Step 2: Calculate the Pearson correlation from the original values. The means are \(\bar X=21/6=3.5\) and \(\bar Y=63/6=10.5\). The centered sums are
where \(\sum Y_i^2=1+4+16+64+256+1024=1365\). The cross-product sum is
Therefore the Pearson correlation is
Rounded to four decimals, Pearson correlation is \(0.9058\), while Spearman correlation is \(1.0000\). Both indicate positive association, but the rank coefficient reflects the perfect ordering without requiring the exponential pattern to be linear. The common mistake is to conclude that perfect rank association means a perfect straight-line relationship; it means the ordering is perfectly aligned, not that the original values lie on a line.
Rank Association Is Not Every Kind of Dependence
A rank coefficient is designed to summarize monotone association: broadly, whether one variable tends to increase or decrease as the other increases. A relationship can be strongly structured but non-monotone, such as a U-shape, and still have a rank correlation near zero. A small rank coefficient therefore does not establish independence. Conversely, a large rank coefficient does not by itself describe how often both risks experience extreme outcomes together.
Worked Example: A Non-Monotone Pattern
Consider six hypothetical paired observations, with \(X=1,2,3,4,5,6\) and \(Y=25,9,1,0,4,16\), respectively. The values decrease and then increase, so the pattern is not monotone. There are no ties, and no probability distribution is assumed. Calculate Spearman’s coefficient and interpret it.
Step 1: Rank each variable. The \(X\) ranks are \(1,2,3,4,5,6\). Sorting the \(Y\) values \(0,1,4,9,16,25\) from smallest to largest gives \(Y\) ranks \(1,2,3,4,5,6\); in the original pair order, the \(Y\) ranks are \(6,4,2,1,3,5\).
Step 2: Find the squared rank differences. In order of the observations, \(d_i=R_i-S_i\) is \(-5,-2,1,3,2,1\). Hence \(\sum d_i^2=25+4+1+9+4+1=44\).
The modest negative coefficient does not summarize the visible U-shaped pattern well: the value of \(Y\) is low near the middle of the \(X\) range and higher toward both ends. The result is a warning against interpreting a rank correlation near zero as proof that the variables are unrelated. Rank correlation measures monotone association, not arbitrary nonlinear structure.
Calculation Traps and Interpretation
A reliable calculation keeps original values and ranks distinct. Rank each variable separately, preserve the pairing between observations, and then calculate the correlation of the paired ranks. If there are no ties, the shortcut is convenient; if there are ties, use average ranks and the Pearson correlation of those ranks rather than the no-ties shortcut.
For example, in the six-observation exponential data above, directly using the raw differences \(X_i-Y_i\) in the shortcut gives squared differences summing to \(0+0+1+16+121+676=814\). Substitution would produce
That impossible value exposes the error: the shortcut requires differences between ranks, not differences between the original measurements. The correct ranks in that example match exactly, so \(\sum d_i^2=0\) and \(r_s=1\).
Check Your Understanding
For questions involving ranks, assume there are no ties unless stated otherwise. Give coefficients to four decimal places where needed.
- For four paired observations, the \(X\) ranks are \(1,2,3,4\) and the corresponding \(Y\) ranks are \(2,1,4,3\). Find Spearman’s coefficient. (Answer: \(0.6000\))
- Five projects have \(X\) ranks \(1,2,3,4,5\) and \(Y\) ranks \(3,1,2,5,4\). Calculate the rank correlation from the squared rank differences. (Answer: \(0.6000\))
- Six paired measurements have \(X\) ranks \(1,2,3,4,5,6\) and corresponding \(Y\) ranks \(1,3,2,4,6,5\). Calculate Spearman’s coefficient. (Answer: \(0.8857\))
- Suppose \(Y\) is a strictly decreasing function of \(X\) over a set of distinct observations. What is Spearman’s coefficient, and what does it say about the ordering? (Answer: \(-1\); the rankings are exactly reversed.)
- Five hypothetical exposure scores are \(X=10,20,30,40,50\), paired with \(Y=3,8,5,20,12\). Rank each variable and calculate Spearman’s coefficient. (Answer: \(0.8000\))