Skip to content
Celeus

Spearman correlation

Shown in the app as spearman. Part of the method reference, under Association and correlation.

When to use

Monotonic association between two continuous/ordinal variables.

What you provide

  • The two numeric variables: two numeric columns.

Options

Missing data

  • Complete case (listwise deletion)
  • Mean imputation (single)
  • Median imputation (single)

Multiple comparisons

  • Not adjustable for this method. Where it makes post-hoc comparisons, the procedure applies its own correction.

Alternatives that take the same inputs:

Other methods under Association and correlation:

Guides that discuss this method

How to read the output

These methods ask whether two numeric measurements taken on the same units go up and down together, for example hours studied and exam score across students, or rainfall and crop yield across fields. The reported sample size is the number of complete pairs.

Pearson correlation. The estimate is Pearson’s r, from -1 to 1, which measures how closely the pairs follow a straight line. It comes with a 95% confidence interval based on Fisher’s z transformation, given when there are at least 4 complete pairs. The test statistic is t on n - 2 degrees of freedom, and the p-value is two-sided. The effect size is r itself, not r-squared. The test assumes roughly bivariate-normal data with no strong outliers, and a single extreme pair can move r a long way. Celeus does not test linearity or outliers. Before the run it screens each variable for normality (Shapiro-Wilk) and suggests Spearman if one looks non-normal, but the only check recorded with the Pearson result is a small-sample warning below 10 observations, so plot the two variables before reading the number. If the relationship is curved but consistently rising or falling, or outliers are a concern, Spearman correlation is the alternative.

Spearman correlation. Spearman’s rho is Pearson’s r computed on the ranks of the values, so it captures any monotonic association (one variable tends to rise as the other rises, not necessarily along a straight line) and is robust to outliers and non-normal data. The test statistic is S and the p-value is two-sided: exact for very small samples (under 10 pairs) without tied values, a close approximation for larger ones, and approximate when there are ties. Celeus reports no confidence interval for rho, because the underlying R procedure does not produce one. Values recorded only as below a detection limit can be included, as long as the limit leaves their order relative to the other values clear (see below-detection-limit data). For straight-line association on roughly normal data, see Pearson correlation.

Reading the two together. Because Pearson measures straight-line association and Spearman measures monotonic association, the two can differ on the same data, and a large gap between them is a reason to look at the scatter plot. Neither says that one variable causes the other. A strong correlation between two methods that measure the same quantity also does not show that they agree, because one can be consistently higher than the other.

Sources: Pearson K (1896), Philosophical Transactions of the Royal Society A 187:253-318, doi:10.1098/rsta.1896.0007. Spearman C (1904), American Journal of Psychology 15(1):72-101, doi:10.2307/1412159. Fisher RA (1915), the sampling distribution of the correlation coefficient, Biometrika 10(4):507-521, doi:10.2307/2331838.

Worked example

Celeus's result on a published or illustrative dataset, next to an independent computation and, where one exists, a published value. The data themselves are not reproduced here.

datasets::mtcars

  • Source: Published dataset distributed with an R package
  • Licence: base R (GPL)
  • Reference: Henderson & Velleman (1981)
QuantityCeleusIndependent computationPublished valueAgrees
p-value1.48759e-111.48759e-11-Yes

Validation report

References

  1. Spearman, C. (1904). The proof and measurement of association between two things. The American Journal of Psychology 15: 72-101. doi:10.2307/1412159 doi:10.2307/1412159