Pearson vs. Spearman Correlation: What’s the difference?

Anyi Guo
5 min readSep 6, 2021

A practical guide on their difference, with examples!

A correlation coefficient measures how much two variables tend to change in relation to each other. The coefficient describes both the direction as well as the strength of the relationship. In this article we’ll go through two of the most popular correlation calculation methods: Pearson’s Correlation and Spearman’s Correlation.

Pearson’s correlation (P)

Pearson’s correlation (named after Karl Pearson) is used to show linear relationship between two variables. It is calculated as:

Pearson Correlation = covariance (X, Y) / (stdv(X) * stdv(Y))
Pearson Correlation = covariance (X, Y) / (stdv(X) * stdv(Y))

Pearson’s Correlation returns a value between [-1, 1], with 1 meaning full positive correlation and -1 full negative correlation.

Pearson’s Correlation uses mean and standard deviation in the calculation, which implies that it is a parametric method and it assumes a Gaussian-like distribution for the data.

Pearson’s Correlation is the most popular method of calculating correlation and it tends to be the default implementation in many programming languages. For example, if you run corr() method on a Pandas…

--

--

Anyi Guo
Anyi Guo

Written by Anyi Guo

Head of Data Science @ UW. This is my notepad for thoughts on data science, machine learning & AI.