01 / 20

Fitting Linear
Functions to Data

Compute and interpret the correlation coefficient \( r \) to measure how well a linear model fits a scatter plot of data.

Statistics & Probability

Starting With a Scatter Plot

When we collect paired data (like hours studied and test scores), we plot each pair as a point. The resulting scatter plot shows whether the two variables move together.

Score Hours Studied

The Line of Best Fit

A linear model (the line of best fit) summarizes the trend with the equation \( \hat{y} = a + bx \), where \( b \) is the slope and \( a \) is the \( y \)-intercept. It minimizes the total squared distance to all points.

\(\hat{y}=a+bx\)

The Correlation Coefficient \( r \)

The correlation coefficient \( r \) is a single number that measures the strength and direction of a linear relationship. It always falls between \( -1 \) and \( +1 \).

\( r = +1 \)
Perfect positive: all points lie exactly on an upward line.
\( r = 0 \)
No linear relationship: points show no straight-line trend.
\( r = -1 \)
Perfect negative: all points lie exactly on a downward line.

The Formula for \( r \)

Though we usually compute \( r \) with technology, the formula shows what it measures: how the \( x \) and \( y \) values vary together relative to how they vary individually.

Each term standardizes a point's \( x \) and \( y \) values using the means \( \bar{x}, \bar{y} \) and standard deviations \( s_x, s_y \), then averages the products. Always use technology (calculator or spreadsheet) for real data.

What Different \( r \) Values Look Like

\(r \approx 0.95\)
\(r \approx 0.6\)
\(r \approx -0.9\)

\( r \) vs. \( r^2 \)

Don't confuse the correlation coefficient \( r \) with the coefficient of determination \( r^2 \). They describe related but different things.

\( r \) \( r^2 \)
Range\( -1 \) to \( +1 \)\( 0 \) to \( 1 \)
Shows sign?Yes (direction)No (always \( \geq 0 \))
MeaningStrength & direction% of variation explained
Example\( r = -0.8 \)\( r^2 = 0.64 \)

Correlation Is Not Causation

A high \( |r| \) means the variables are linearly associated, but it does not prove one causes the other. A hidden third variable may drive both.

Strong \( r \)
Ice cream sales and drowning deaths both rise in summer.
Lurking Variable
Hot weather causes both, not ice cream causing drowning.

Computing \( r \): Step by Step

1
Enter the data. Put \( x \)-values in one list and \( y \)-values in another on your calculator or spreadsheet.
2
Run linear regression. Use the regression tool (e.g. LinReg) to fit \( \hat{y} = a + bx \).
3
Read \( r \). The output displays \( r \) (and \( r^2 \)). Turn on "DiagnosticOn" if \( r \) is hidden.
4
Interpret. Use the sign for direction, \( |r| \) for strength, and check the scatter plot.

Worked Example: Reading \( r \)

A regression on temperature vs. ice cream sales gives \( \hat{y} = 12 + 4.5x \) with \( r = 0.92 \). Interpret this result.

Temperature

Worked Example: Finding \( r^2 \)

A study of car age vs. resale value reports \( r = -0.85 \). Compute \( r^2 \) and interpret both values.

Worked Example: Compare Two Fits

Two models predict exam scores. Model A has \( r = 0.74 \); Model B has \( r = -0.91 \). Which model fits its data better?

Model A
\(r = 0.74\)
Model B
\(r = -0.91\)

Common Mistakes

✕ Sign = Strength
Thinking \( r = -0.9 \) is "weaker" than \( r = 0.5 \). The negative one is actually stronger.
✕ Confusing \( r \) and \( r^2 \)
Reporting \( r^2 \) as the correlation. Remember \( r^2 \) is always positive and measures explained variation.
✕ Claiming Causation
Saying \( x \) causes \( y \) just because \( |r| \) is high. Correlation never proves cause.
✕ Ignoring the Plot
Trusting \( r \) alone. A curved pattern can give a small \( r \) even with a clear relationship.

Interpreting \( |r| \): Quick Guide

\( |r| \) Value Strength Fit Quality
\( 0.9 \leq |r| \leq 1 \)Very strongExcellent linear fit
\( 0.7 \leq |r| < 0.9 \)StrongGood fit
\( 0.4 \leq |r| < 0.7 \)ModerateFair fit
\( 0 \leq |r| < 0.4 \)WeakPoor linear fit

Question 1 of 5

Which value of \( r \) indicates the strongest linear relationship?

Question 2 of 5

A regression gives \( r = -0.6 \). What is \( r^2 \), and what does it mean?

Question 3 of 5

A scatter plot shows points trending downward in a tight line. Which \( r \) value fits best?

Question 4 of 5

Sunscreen sales and shark attacks both have \( r = 0.85 \) with summer days. What can we conclude?

Question 5 of 5

According to the strength guide, an \( |r| \) value of \( 0.55 \) describes which kind of fit?

Key Takeaways

1
\( r \) measures linear fit. It ranges from \( -1 \) to \( +1 \); sign gives direction, magnitude gives strength.
2
Use technology. Compute \( r \) with a calculator or spreadsheet's regression tool.
3
\( r^2 \) is the % explained. It's the fraction of variation in \( y \) accounted for by the model.
4
Correlation ≠ causation. Always interpret \( r \) alongside the scatter plot and real context.