Learn
Interactive·

Correlation & Covariance

Two variables can move in the same direction while the numerical size of that movement changes with the units.

To ask whether months with higher advertising spending also have higher sales, we need to examine how the two variables move together. But the numerical size of covariance changes depending on whether spending is recorded in dollars or thousands of dollars.

Correlation standardizes covariance so that the direction and strength of a linear relationship can be compared without depending on measurement units.

Key question

How can joint movement between two variables be summarized in a unit-free number?

1

Concept

What does covariance describe?

Covariance checks whether two variables deviate from their means in the same direction

CovarianceInterpretation
Positivewhen x is above its mean, y also tends to be above its mean
Negativewhen x is above its mean, y tends to be below its mean
Near zeroweak linear co-movement

Sample covariance

cov(x,y) = Σ(xᵢ−x̄)(yᵢ−ȳ) / (n−1)

If the two deviations have the same sign, their product is positive; if they have opposite signs, it is negative. Covariance is measured in x-units × y-units, which makes its magnitude hard to compare across scales.

2

Why It Matters

Why standardize with correlation?

Correlation divides covariance by both standard deviations

Pearson correlation

r = cov(x,y) / (sₓsᵧ)

Standardization removes the units and restricts the result to −1 through 1. Changing y from dollars to thousands of dollars changes covariance but leaves correlation unchanged.

3

How It Works

How should correlation be read?

The sign gives direction; the absolute value gives linear strength

rMeaning
+1all points lie on an upward-sloping line
0no visible linear relationship
−1all points lie on a downward-sloping line

r=−0.8 and r=0.8 indicate similar linear strength but opposite direction. In simple linear regression with an intercept, r² equals the proportion of sample variation in y explained by the fitted line.

Strength depends on context

Whether 0.3 is small or meaningful depends on the field, measurement reliability, observed range, and purpose of the analysis.

4

Example

What can correlation miss?

A correlation coefficient cannot describe the whole relationship

  • A strong curved relationship can have Pearson r near zero.
  • A single outlier can change the coefficient substantially.
  • A high correlation may reflect a common cause or shared time trend.
  • A restricted range can make the observed correlation smaller than the broader relationship.
  • Combining groups can produce a direction opposite to the within-group relationships.

Inspect first

Before computing correlation, examine a scatterplot for direction, curvature, groups, and unusual observations.

5

Interactive

Change the relationship and scale

Change the relationship and scale

First change the relationship direction and inspect the signs of covariance and correlation. Then rescale the y-axis and compare how covariance changes while correlation remains stable.

Covariance

8.86

Correlation

0.90

xy

What to notice

Covariance changes with measurement units. Correlation is standardized, so it preserves the direction and linear strength under a simple rescaling.

Key takeaways

  • Covariance indicates the direction of co-movement but depends on measurement units.
  • Correlation standardizes covariance to a value between −1 and 1.
  • The sign gives direction; the absolute value gives linear strength.
  • Correlation does not fully describe nonlinear patterns, group structure, or causation, so inspect a scatterplot as well.
Next: Scatterplots & Boxplots