Skip to content
Tutorials Center
My learning

Topics

Lesson 27 of 37 ยท Correlation and Regression

Scatter Plots and Correlation

Learn to draw and read scatter plots, describe direction, form and strength, spot outliers, and understand why correlation does not prove causation.

So far you have mostly studied one variable at a time. Often the interesting question involves two: Do students who study longer score higher? Does a taller person weigh more? Does ice cream consumption rise with temperature? To explore such questions, pair up the values and plot them.

A scatter plot puts one variable on the horizontal axis (often the explanatory variable) and the other on the vertical axis (the response variable). Each individual becomes one dot.

What to describe

When you read a scatter plot, comment on four features:

  • Direction. Positive (as x rises, y tends to rise), negative (y tends to fall), or none.
  • Form. Roughly linear, curved, or clustered.
  • Strength. How tightly the dots hug the pattern: strong, moderate or weak.
  • Outliers. Points far from the pattern, and whether they stand out in x, in y, or both.

Always phrase it in context: "Taller students tend to have longer arm spans; the relationship is strongly positive and linear."

Python Four scatter plots with different patterns

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Correlation: a number for linear association

Correlation measures how well the dots follow a straight line. Its value, written r, runs from -1 to +1:

r Meaning
near +1 strong positive linear relationship
near -1 strong negative linear relationship
near 0 no linear relationship

The next lesson computes r by hand. Remember now that r only measures linear association. A perfect curve can have r = 0.

Correlation is not causation

Two variables can move together without one causing the other.

  • Ice cream sales and sunburn cases rise together in summer. Both are driven by a third variable, hot sunny weather. Such a hidden driver is called a confounding (or lurking) variable.
  • Sometimes the direction is reversed: do people with more books read more, or do avid readers buy more books?
  • Sometimes it is pure coincidence, especially if you hunt through many variables.

To establish causation you need a carefully designed experiment, ideally with random assignment, not just an observed association.

Python A confounder creates a correlation

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

This data is simulated: the code builds the two variables from temperature, with no direct link between them. Yet they correlate overall. Within a narrow temperature band the link largely disappears, because the confounder is held roughly fixed. (With few days in the band the value is noisy, so treat it as an illustration, not a measurement.)

Outliers and influence

A single unusual point can change the picture. An outlier that is far from the other points in the x-direction can pull a fitted line strongly toward itself. Always plot first, then compute. Look at the dots before trusting a number.

Do not extend a pattern far beyond the data you have. Heights and shoe sizes of children say nothing reliable about adults.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In a scatter plot of study hours (x) against test score (y), the dots rise from lower left to upper right. This is a...

    As x increases, y tends to increase, so the association is positive.
  2. 2. A correlation of r = 0 means...

    r measures linear association only. A parabola can give r near 0.
  3. 3. Sunburn cases and ice cream sales rise together. The best explanation is...

    Temperature drives both variables, so they correlate without a direct causal link.
  4. 4. Which is NOT one of the four features to describe in a scatter plot?

    Describe direction, form, strength and outliers. The median of one variable is a separate summary.

Summary

  • A scatter plot pairs two variables; describe direction, form, strength and outliers.
  • Correlation r (from -1 to +1) summarizes linear association only.
  • Correlation does not prove causation: look for confounders and reversed direction.
  • Always plot the data before relying on a number.

Next: The Pearson Correlation Coefficient