Português

Pearson correlation

Association and correlation · reference distribution: t(n−2)

When to use it

Measure and test the linear relationship between two quantitative variables.

Null hypothesis

There is no linear correlation: ρ = 0.

Assumptions

Test statistic

t = \dfrac{r\sqrt{n - 2}}{\sqrt{1 - r^2}}

Effect size

r itself; r² is the share of the variance of one variable explained by the other.

How to report it

r(28) = .42, p = .021

In R and Python

R
cor.test(x, y)
Python
stats.pearsonr(x, y)

In Python, stats is scipy.stats and np is numpy.

Variants and alternatives

Where it sits in the catalog

Association and correlation. Instead of comparing groups, they measure whether two variables move together, and how strongly.

In the decision tree

  1. What do you want to do? Measure the relationship between two variables
  2. What kind of variables are they? Both numeric
  3. Is the relationship linear, without strong extreme values? Yes

Open the decision tree