Fatskills
Practice. Master. Repeat.
Study Guide: How to Solve: IB AI HL/SL – Regression & Correlation (Pearson, Least-Squares, Exponential/Log Models)
Source: https://www.fatskills.com/ib-exams/chapter/how-to-solve-ib-ai-hlsl-regression-correlation-pearson-least-squares-exponentiallog-models

How to Solve: IB AI HL/SL – Regression & Correlation (Pearson, Least-Squares, Exponential/Log Models)

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~6 min read

How to Solve: IB AI HL/SL – Regression & Correlation (Pearson, Least-Squares, Exponential/Log Models)


Introduction

"Mastering regression and correlation lets you predict exam scores from study hours, forecast stock trends, or even prove whether taller people earn more—skills that could earn you 10+ marks on your IB Math AI exam and set you up for university stats."


What You Need To Know First

  1. Scatter plots: How to plot (x, y) data and interpret trends.
  2. Basic algebra: Rearranging equations, solving for unknowns.
  3. Logarithms: Converting exponential data to linear form (for log models).

Key Vocabulary

Term Plain-English Definition Quick Example
Correlation (r) A number between -1 and 1 showing how closely two variables move together. r = 0.9 → Strong positive link.
Regression line The "best-fit" straight line through data points. y = 2x + 3 predicts y from x.
Residual The vertical gap between a data point and the regression line. Point at (2,5), line predicts y=4 → residual = 1.
Least-squares Method to find the line that minimises the sum of squared residuals. Minimises (y₁ - ŷ₁)² + (y₂ - ŷ₂)² + ...
Exponential model Data that grows/decays by a fixed percentage (e.g., y = a·bˣ). Population doubling every year.
Logarithmic model Linearising exponential data using logs (e.g., ln(y) = mx + c). Convert y = 2ˣ to ln(y) = x·ln(2).

Formulas To Know

1. Pearson’s Correlation Coefficient (r)

Formula: [ r = \frac{S_{xy}}{\sqrt{S_{xx} \cdot S_{yy}}} ] - Sₓᵧ = Σ(x - x̄)(y - ȳ) → "Covariance" - Sₓₓ = Σ(x - x̄)² → "Sum of squares for x" - Sᵧᵧ = Σ(y - ȳ)² → "Sum of squares for y" MEMORISE THIS (but check if given on your exam sheet).


2. Least-Squares Regression Line

Formula: [ y = a + bx ] - Slope (b): [ b = \frac{S_{xy}}{S_{xx}} ] - Intercept (a): [ a = \bar{y} - b\bar{x} ] MEMORISE THIS (or derive from Sₓᵧ/Sₓₓ).


3. Exponential Model (y = a·bˣ)

Linearised form: [ \ln(y) = \ln(a) + x \cdot \ln(b) ] - Let Y = ln(y), A = ln(a), B = ln(b) → becomes Y = A + Bx. Given on exam sheet (but know how to use it).


4. Logarithmic Model (y = a + b·ln(x))

Linearised form: - Let X = ln(x) → becomes y = a + bX. Given on exam sheet.


Step-by-Step Method

Step 1: Plot the Data

  • Draw a scatter plot. Check for linearity (straight-line trend) or non-linearity (curve).
  • If curved → linearise using logs (Step 5).

Step 2: Calculate Means (x̄, ȳ)

  • Find the average of x-values (x̄) and y-values (ȳ).

Step 3: Compute Sₓₓ, Sᵧᵧ, Sₓᵧ

  • Sₓₓ = Σ(x - x̄)² → Sum of squared deviations for x.
  • Sᵧᵧ = Σ(y - ȳ)² → Sum of squared deviations for y.
  • Sₓᵧ = Σ(x - x̄)(y - ȳ) → Sum of cross-products.

Step 4: Find r (Correlation)

  • Plug Sₓₓ, Sᵧᵧ, Sₓᵧ into Pearson’s formula.
  • Interpret r:
  • |r| > 0.7 → Strong correlation.
  • 0.3 < |r| < 0.7 → Moderate.
  • |r| < 0.3 → Weak.

Step 5: Find Regression Line (y = a + bx)

  • Slope (b) = Sₓᵧ / Sₓₓ.
  • Intercept (a) = ȳ - b·x̄.
  • Write the equation: y = a + bx.

Step 6: Check for Non-Linearity (If Needed)

  • If scatter plot is curved:
  • Exponential (y = a·bˣ) → Take ln(y) and regress on x.
  • Logarithmic (y = a + b·ln(x)) → Take ln(x) and regress on y.

Step 7: Predict & Interpret

  • Plug x-values into the regression equation to predict y.
  • Extrapolation warning: Predicting outside the data range is risky.

Worked Examples

Example 1 – Basic Linear Regression

Data: | x (Study Hours) | y (Exam Score) | |-----------------|----------------| | 1 | 50 | | 2 | 55 | | 3 | 65 | | 4 | 70 |

Step 1: Plot → Linear trend. Step 2: Means → x̄ = 2.5, ȳ = 60. Step 3: - Sₓₓ = (1-2.5)² + (2-2.5)² + (3-2.5)² + (4-2.5)² = 5 - Sᵧᵧ = (50-60)² + (55-60)² + (65-60)² + (70-60)² = 250 - Sₓᵧ = (1-2.5)(50-60) + (2-2.5)(55-60) + (3-2.5)(65-60) + (4-2.5)(70-60) = 35 Step 4: r = 35 / √(5 × 250) = 0.99 → Very strong correlation. Step 5: - b = 35 / 5 = 7 - a = 60 - 7(2.5) = 42.5 - Regression line: y = 42.5 + 7x Step 6: Predict y when x = 5 → y = 42.5 + 7(5) = 77.5. What we did and why: - Calculated means to centre the data. - Used Sₓₓ, Sᵧᵧ, Sₓᵧ to find the best-fit line. - Predicted a score for 5 study hours.


Example 2 – Medium (Exponential Model)

Data: | x (Years) | y (Population) | |-----------|----------------| | 1 | 2 | | 2 | 4 | | 3 | 8 | | 4 | 16 |

Step 1: Plot → Exponential growth (curved). Step 2: Linearise → Take ln(y): | x | ln(y) | |---|-------| | 1 | 0.693 | | 2 | 1.386 | | 3 | 2.079 | | 4 | 2.773 |

Step 3: Means → x̄ = 2.5, ln(y)̄ = 1.733. Step 4: - Sₓₓ = 5, Sₗₙᵧₗₙᵧ = 2.25, Sₓₗₙᵧ = 3.465 - r = 3.465 / √(5 × 2.25) = 1 → Perfect fit. Step 5: - b = 3.465 / 5 = 0.693 - a = 1.733 - 0.693(2.5) = 0 - Regression line: ln(y) = 0 + 0.693x Step 6: Convert back → y = e⁰·⁶⁹³ˣ = (since e⁰·⁶⁹³ ≈ 2). What we did and why: - Recognised exponential growth → linearised with logs. - Regressed ln(y) on x to find the model y = 2ˣ.


Example 3 – Exam-Style (Logarithmic Model)

Question: "The table shows the relationship between advertising spend (x, in $1000s) and sales (y, in $1000s). Find the logarithmic regression model y = a + b·ln(x) and predict sales when $5000 is spent."

x y
1 10
2 15
3 18
4 20

Step 1: Plot → Logarithmic trend (curve flattens). Step 2: Linearise → Let X = ln(x): | X = ln(x) | y | |-----------|---| | 0 | 10| | 0.693 | 15| | 1.099 | 18| | 1.386 | 20|

Step 3: Means → X̄ = 0.794, ȳ = 15.75. Step 4: - Sₓₓ = 1.147, Sᵧᵧ = 56.75, Sₓᵧ = 7.97 - r = 7.97 / √(1.147 × 56.75) = 0.99 → Strong fit. Step 5: - b = 7.97 / 1.147 = 6.95 - a = 15.75 - 6.95(0.794) = 10.2 - Regression line: y = 10.2 + 6.95·ln(x) Step 6: Predict x = 5 → y = 10.2 + 6.95·ln(5) = 21.5. What we did and why: - Recognised logarithmic trend → linearised with ln(x). - Regressed y on ln(x) to find the model. - Predicted sales for $5000 spend.


Common Mistakes

  1. MISTAKE: Forgetting to calculate means (x̄, ȳ).
    WHY IT HAPPENS: Skipping steps to save time.
    CORRECT APPROACH: Always find means first—they’re needed for Sₓₓ, Sᵧᵧ, Sₓᵧ.

  2. MISTAKE: Mixing up Sₓₓ and Sᵧᵧ in Pearson’s formula.
    WHY IT HAPPENS: Confusing the order of variables.
    CORRECT APPROACH: Remember: r = Sₓᵧ / √(Sₓₓ·Sᵧᵧ).

  3. MISTAKE: Using the wrong linearisation (e.g., taking ln(x) for exponential data).
    WHY IT HAPPENS: Not checking the scatter plot first.
    CORRECT APPROACH: Exponential → ln(y). Logarithmic → ln(x).

  4. MISTAKE: Extrapolating too far outside the data range.
    WHY IT HAPPENS: Assuming trends continue forever.
    CORRECT APPROACH: State predictions are only valid within the given x-range.

  5. MISTAKE: Rounding intermediate values too early.
    WHY IT HAPPENS: Trying to simplify calculations.
    CORRECT APPROACH: Keep 4+ decimal places until the final answer.


Exam Traps

  1. Trap: Giving r = 1.5 (impossible, since |r| ≤ 1).
    How to Spot it: Check if r is between -1 and 1.
    How to Avoid it: Recalculate Sₓₓ, Sᵧᵧ, Sₓᵧ—you likely made a sign error.

  2. Trap: Being asked for the interpretation of r but only giving the number.
    How to Spot it: The question says "describe the correlation".
    How to Avoid it: Always add: "Strong/weak, positive/negative correlation."

  3. Trap: Forgetting to convert back from ln(y) to y in exponential models.
    How to Spot it: The question asks for y, but your answer is ln(y).
    How to Avoid it: Write: "Exponentiate both sides: y = e^(ln(y))".


1-Minute Recap

"Here’s the night-before cheat sheet for regression and correlation: 1. Plot first—if it’s curved, linearise with logs. 2. Calculate means (x̄, ȳ) and sums (Sₓₓ, Sᵧᵧ, Sₓᵧ). 3. Pearson’s r = Sₓᵧ / √(Sₓₓ·Sᵧᵧ). Closer to 1 or -1 = stronger link. 4. Regression line: y = a + bx, where b = Sₓᵧ/Sₓₓ and a = ȳ - b·x̄. 5. Exponential? Take ln(y) and regress on x. Logarithmic? Take ln(x) and regress on y. 6. Predict by plugging x into the equation—but don’t extrapolate wildly! Double-check units, round at the end, and always interpret r. You’ve got this!




ADVERTISEMENT