GloNeuro

Learn / Research design

Correlation

Correlation coefficients summarise in a single number how closely two measures rise and fall together. They capture only one kind of relationship and can mislead.

What a correlation is

A correlation is an association between two ordered variables in which one tends to be higher when the other is higher (a positive correlation) or lower (a negative correlation).

A correlation coefficient expresses this tendency as a number between −1 and 1. At 1 or −1 the points lie exactly on a line, or in exactly the same or opposite order; at 0 there is no such tendency.

Pearson’s r
Measures how closely the points follow a straight line1,2.
Spearman’s ρ (rho)
Pearson’s r calculated on the ranks of the values instead of the values themselves3. Using ranks makes it robust against outliers2.
Kendall’s τ (tau)
Compares every pair of points and asks whether they are in the same order on both variables4. The page computes τ-b, which corrects for ties5.

Sampling variation in r

A sample correlation r varies around the population value ρ, and the variation is larger in small samples.

Sample size, n

Simulated pairs of measurements. Below the scatter plot are the correlations of the last 20 samples (dots) with their 95% confidence intervals (lines), and the population value ρ (vertical line). About 95% of the intervals should contain ρ.

What r and r² mean

Pearson’s r is the average product of the two variables after each has been converted to standard units. Its square, r², is the proportion of the variation in one variable that a straight line accounts for. An r of 0.5 gives r² = 0.25, leaving three-quarters of the variation unexplained. Neither r nor r² says whether one variable causes the other.

Pearson and Spearman coefficients: outliers and curves

A single extreme point can change Pearson’s r greatly, and r underestimates relationships that are consistent but curved. Rank coefficients are much less affected, because an outlier can take only the highest or lowest rank.

Data

Simulated data sets. The highlighted point can be dragged or moved with the arrow keys. Very different patterns can share similar coefficients, so a scatterplot should be inspected before a coefficient is calculated6,2.

Range restriction

If a study includes only part of the range of a variable, for example only people with high screening scores, the correlation within that range can be much weaker than in the population, although the relationship is unchanged.

Simulated population of 400 people with a moderate correlation between a screening score and a later outcome. Only people inside the window are included in the study.

The ecological fallacy

A correlation between group averages, such as regional averages, can differ greatly from the correlation among individuals. Inferring one from the other is the ecological fallacy7,8.

Show

Simulated data from five regions. Within every region the correlation is negative, yet the region averages are positively correlated.

Regression to the mean

People selected for an unusually high or low score were, on average, partly lucky or unlucky on that occasion, so when measured again they tend to score closer to the average, even if nothing has changed. This is a common reason why an untreated group appears to improve9. The effect is stronger when a measurement is less reliable, and a randomised control group, measured in the same way, is the main safeguard.

Simulated test and retest scores for 200 people whose true ability does not change. The people with the highest 10% of first scores (coloured) score closer to the mean at the second test.

Shared trends over time

Two unrelated quantities that both drift upwards over the same years can be strongly correlated; Yule called these nonsense correlations10. Correlating the year-to-year changes instead of the levels removes the shared trend11.

Two simulated series generated independently, each with an upward drift plus random variation, over 30 years.

Correlation and individual prediction

A correlation that is reliable for a group can say little about an individual. If hippocampal volume correlates with a memory score at r = 0.3, one person’s volume narrows the likely range of his or her score only slightly.

Simulated data in standard units. The shaded band is the 95% prediction interval for an individual; the outer dashed lines show the interval that ignores the horizontal variable.

Significance test and confidence interval for r

A correlation r from n pairs is tested against zero with a t statistic on n − 2 degrees of freedom12:

t = r √(n − 2) / √(1 − r²)

The confidence interval uses Fisher’s z transformation, which makes the sampling distribution close to normal13:

z = artanh(r) = ½ ln[(1 + r) / (1 − r)],   SE = 1 / √(n − 3)

The interval z ± 1.96 × SE is converted back with r = tanh(z), so it is not symmetrical around r.

Test and confidence interval for a given correlation and sample size. The results were checked against SciPy’s pearsonr.

Practice case: does sleep relate to memory scores?

A short conversation about one simulated study. Answer each card to continue. To plan a study of your own, use the study designer.

References

  1. Pearson, K. (1895). Note on regression and inheritance in the case of two parents. Proceedings of the Royal Society of London, 58, 240–242. https://doi.org/10.1098/rspl.1895.0041
  2. Janse, R. J., Hoekstra, T., Jager, K. J., Zoccali, C., Tripepi, G., Dekker, F. W., & van Diepen, M. (2021). Conducting correlation analysis: important limitations and pitfalls. Clinical Kidney Journal, 14(11), 2332–2337. https://doi.org/10.1093/ckj/sfab085
  3. Spearman, C. (1904). The proof and measurement of association between two things. The American Journal of Psychology, 15(1), 72. https://doi.org/10.2307/1412159
  4. Kendall, M. G. (1938). A new measure of rank correlation. Biometrika, 30(1–2), 81–93. https://doi.org/10.1093/biomet/30.1-2.81
  5. Kendall, M. G. (1945). The treatment of ties in ranking problems. Biometrika, 33(3), 239–251. https://doi.org/10.1093/biomet/33.3.239
  6. Anscombe, F. J. (1973). Graphs in statistical analysis. The American Statistician, 27(1), 17–21. https://doi.org/10.1080/00031305.1973.10478966
  7. Robinson, W. S. (1950). Ecological correlations and the behavior of individuals. American Sociological Review, 15(3), 351. https://doi.org/10.2307/2087176
  8. Lokar, K., Zagar, T., & Zadnik, V. (2019). Estimation of the ecological fallacy in the geographical analysis of the association of socio-economic deprivation and cancer incidence. International Journal of Environmental Research and Public Health, 16(3), 296. https://doi.org/10.3390/ijerph16030296
  9. Linden, A. (2013). Assessing regression to the mean effects in health care initiatives. BMC Medical Research Methodology, 13, 119. https://doi.org/10.1186/1471-2288-13-119
  10. Yule, G. U. (1926). Why do we sometimes get nonsense-correlations between time-series? A study in sampling and the nature of time-series. Journal of the Royal Statistical Society, 89(1), 1. https://doi.org/10.2307/2341482
  11. Simms, L. E., Engebretson, M. J., & Reeves, G. D. (2022). Removing diurnal signals and longer term trends from electron flux and ULF correlations: a comparison of spectral subtraction, simple differencing, and ARIMAX models. Journal of Geophysical Research: Space Physics, 127(2), e2021JA030021. https://doi.org/10.1029/2021JA030021
  12. Fisher, R. A. (1915). Frequency distribution of the values of the correlation coefficient in samples from an indefinitely large population. Biometrika, 10(4), 507. https://doi.org/10.2307/2331838
  13. Fisher, R. A. (1921). On the “probable error” of a coefficient of correlation deduced from a small sample. Metron, 1, 3–32. https://hdl.handle.net/2440/15169
  14. Leys, C., Delacre, M., Mora, Y. L., Lakens, D., & Ley, C. (2019). How to classify, detect, and manage univariate and multivariate outliers, with emphasis on pre-registration. International Review of Social Psychology, 32(1), 5. https://doi.org/10.5334/irsp.289

Last updated