IB Maths AI HLNon-linear RegressionPaper 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
Non-linear regression fits a curve to data. Exam models: quadratic, cubic, exponential (abx or aebx), power (axb), sine.
Use your GDC: enter the data, choose the model the question names, read off the constants.
Residual = actual y − predicted y = yi − f(xi).
SSres = sum of the squared residuals. For models on the same data, smaller SSres = better fit.
The least squares regression curve is the curve (of a chosen type) that minimisesSSres.
R2 (coefficient of determination): the proportion of the variation in y explained by the model. Closer to 1 = better fit.
For linear models, R2 = r2 (square of the PMCC).
High R2 ≠ best model: more parameters can force R2 up without being more accurate (a cubic through 4 points gives R2 = 1).
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.
Model
Form
Linear
y = ax + b
Quadratic
y = ax2 + bx + c
Cubic
y = ax3 + bx2 + cx + d
Exponential
y = abx or y = aebx
Power
y = axb
Sine
y = 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 residualsSSres = Σ (yi − f(xi))2smaller SS_res = better fit (same data)
residuals — the gaps the curve tries to shrink
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
Predict y for each x using each model.
Find each residual: actual y − predicted y.
Square and sum the residuals for each model → SSres.
Choose the smaller SSres — it fits better (same data only).
🤔 Why isn’t SSres always fair?
SSresgrows 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 onlyR2 = r2R² 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 GDCa = −0.000529… b = 0.2030… c = −24.89… d = 1037.7…y = −0.000529x³ + 0.203x² − 24.9x + 1040the 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 = 100cubic: y ≈ 49.6 sine: y ≈ 53.7the 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 valuesM₁: 90, 67.5, 54 M₂: 105, 70, 52.5SS_res for M₁(97−90)² + (68−67.5)² + (55−54)² = 49 + 0.25 + 1 = 50.25SS_res for M₂(97−105)² + (68−70)² + (55−52.5)² = 64 + 4 + 6.25 = 74.25choose 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.802the quadratic model fits betterhigher 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 explained0.57 → 57%57% of the variation in y is explained by the variation in xthe remaining 43% is due to other factors.
💡 Top tips
Let the GDC do it — enter data, pick the named model, read off the constants and R2.
Smaller SSres = better fit; bigger R2 = better fit (closer to 1).
Only compare SSres on the same data (same number of pairs).
Interpret R2 as a percentage of the variation in y explained.
Don’t blindly pick the highest R2 — more parameters inflate it (cubic through 4 points → R2 = 1).
For linear models, R2 = r2 — some GDCs label it r².
⚠ Common mistakes
Comparing SSres across different sample sizes. It grows with n — only compare on the same data.
Thinking bigger SSres is better. Smaller is better.
Assuming highest R2 = best model. Extra parameters can inflate it without improving accuracy.
Saying R2 = 0.86 means “86% correlation”. It means 86% of the variation is explained.
Rounding constants too early before predicting — keep full GDC values.
Forgetting R2 = r2 is for linear models only.
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.