Data Science · Intermediate level

Intermediate level · Module 4: Relationships and Regression for Analysis · Lesson 1 of 3

Correlation

Measure the strength and direction of relationships and understand what correlation does not show.

In this lesson you will

  • Calculate Pearson and Spearman correlations
  • Explain why correlation is not causation

Key concepts

Pearson correlationSpearman correlationscatter plotcorrelation vs causation

The lesson

Correlation measures how two numeric variables move together, from −1 to +1. Pearson's correlation measures straight-line relationships; Spearman's uses ranks and suits curved but consistent relationships and outliers.

Always plot the data: very different patterns can share the same correlation, and one outlier can create or hide a correlation.

Correlation does not show cause. Two variables may both be driven by a third — wealthier areas have both better schools and better water.

Step by step

  1. Plot attendance against distance to school.
  2. Calculate Pearson and Spearman correlations.
  3. Remove an outlier and recalculate.
  4. Suggest a possible third variable.

Practice activity

Analyse the relationships between attendance and three factors with plots and correlations.

Expected result: Correct correlations with plots and cautious interpretation.

Check your understanding

  1. When is Spearman correlation preferable?

    Show answer

    For monotonic but non-linear relationships or when outliers are present.

  2. Why can correlation not prove causation?

    Show answer

    A third factor may drive both variables, or the direction may be reversed.

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.