IB Maths AI HL Non-linear Regression Paper 1 & 2 ~7 min read

Least Squares Regression Curves & Coefficient of Determination

Not every relationship is a straight line. Non-linear regression fits a curve — quadratic, cubic, exponential, power, or sine — to bivariate data. Your GDC does all the heavy lifting: type in the data, pick the model the question names, read off the constants. To compare two models you use the sum of squared residuals (SSres — smaller is better) or the coefficient of determination (R2 — closer to 1 is better).

📘 What you need to know

The regression models

The question tells you which model to fit. Match the named model to its form, enter the data, and read off the constants.

ModelForm
Lineary = ax + b
Quadraticy = ax2 + bx + c
Cubicy = ax3 + bx2 + cx + d
Exponentialy = abx  or  y = aebx
Powery = axb
Siney = a sin(bx + c) + d
Plot it too: use your GDC to overlay the regression curve on the scatter diagram — it shows at a glance how well the model fits.

Residuals and SSres

A residual is the vertical gap between a data point and the curve. Square them all and add them up to get SSres.

Sum of squared residuals SSres = Σ (yif(xi))2 smaller SS_res = better fit (same data)
residuals — the gaps the curve tries to shrink
x y y = f(x) dashed = residual = actual y − predicted y
The least squares curve is positioned so the total of the squared residuals is as small as possible for that type of model.

🧭 Recipe — comparing two models with SSres

  1. Predict y for each x using each model.
  2. Find each residual: actual y − predicted y.
  3. Square and sum the residuals for each model → SSres.
  4. Choose the smaller SSres — it fits better (same data only).

🤔 Why isn’t SSres always fair?

SSres grows with more data points, so you can only compare two models built on the same number of pairs. 10 points with residual 15 each, and 2250 points with residual 1 each, both give SSres = 2250 — but the second fits far better. That’s why comparing across different sample sizes needs the mean squared error (MSe = SSres ÷ n) instead.

Coefficient of determination R²

R2 tells you what proportion of the variation in y the model explains. The closer to 1, the better the fit.

R² near 1
good fit
Most of the variation in y is explained by the model. R² = 1 is a perfect fit.
R² near 0
poor fit
Little of the variation in y is explained. The model barely captures the trend.
For linear models only R2 = r2 R² is the square of the PMCC for linear models

🧠 Memory aid — “R² = % explained”

R2 = 0.86 means 86% of the variation in y is explained by the model; the other 14% is down to other factors. To compare models, just pick the bigger R2 — but remember a higher R2 isn’t automatically the better model.

🤔 Why doesn’t the highest R² always win?

Models with more parameters fit more easily. A cubic (4 parameters) forced through exactly 4 points gives R2 = 1 — but that doesn’t make it the best description of the relationship. A quadratic with the same data has one more point than it needs, so it can actually be more reliable. Always sanity-check the fit, don’t just chase the biggest R2. (Minimum pairs: linear 2, quadratic 3, cubic 4.)

Worked examples

WE 1

Fit a cubic model

Film length (x min) and rating (y %) are recorded for 9 films. Find the cubic regression model y = ax3 + bx2 + cx + d.

enter data, choose cubic model on GDC a = −0.000529… b = 0.2030… c = −24.89… d = 1037.7… y = −0.000529x³ + 0.203x² − 24.9x + 1040 the GDC gives all four constants — just read them off.
WE 2

Compare two models with a prediction

A cubic model gives y = 49.640… and a sine model gives y = 53.690… for a film 100 minutes long. Whose model predicts the higher rating?

compare the two predictions at x = 100 cubic: y ≈ 49.6 sine: y ≈ 53.7 the sine model predicts higher (≈ 53.7%) substitute the same x into each model and compare.
WE 3

Choose a model using SSres

Membership data: p = 10, 20, 30 gives M = 97, 68, 55. Two models: M1 = 2700p+20 and M2 = 2100p+10. Which has the smaller SSres?

predicted values M₁: 90, 67.5, 54 M₂: 105, 70, 52.5 SS_res for M₁ (97−90)² + (68−67.5)² + (55−54)² = 49 + 0.25 + 1 = 50.25 SS_res for M₂ (97−105)² + (68−70)² + (55−52.5)² = 64 + 4 + 6.25 = 74.25 choose M₁ (smaller SS_res) smaller SS_res = better fit on the same data.
WE 4

Choose a model using R²

Cheetah length vs speed is fitted with two models. Quadratic: R2 = 0.86429… Exponential: R2 = 0.80157… Which fits better?

compare R² (closer to 1 is better) quadratic 0.864 > exponential 0.802 the quadratic model fits better higher R² = more of the variation in y explained.
WE 5

Interpret R²

A model has R2 = 0.57. Interpret this value.

R² = proportion of variation explained 0.57 → 57% 57% of the variation in y is explained by the variation in x the remaining 43% is due to other factors.

💡 Top tips

⚠ Common mistakes

Next up — Logarithmic Scales. When data spans a huge range (populations from hundreds to billions), a normal axis can’t show it all. A log scale spaces the values out evenly — and on log-log or semi-log graphs, power and exponential curves straighten into lines you can read off easily.

Need help with Non-linear Regression?

Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.

Book Free Session →