KS Maths
Year 11 Standard · Unit 5 Ready for the Diploma · Lesson 4 of 6

Choosing and fitting a model

How do you decide which kind of curve to fit, and how good is the fit?

A table of data does not say which function made it. This lesson asks how to choose a family to try, how to fit it by hand so that a GDC can be checked, and how to measure how far a model sits from the data.

FunctionsGDC optional

Words you need (10 key words in this lesson)

The maths words this lesson uses, in plain English. Open this before you start if English is not your first language.

model
A maths rule or equation that describes a real situation.A linear model for the cost of a taxi.
constant
A number that does not change.In 3x plus 5, the constant is 5.
ratio
Compares two or more amounts. It shows how many times one fits into the other.Boys to girls is 2 to 3.
square
Multiply a number by itself. Also, a shape with four equal sides and four right angles.5 squared is 25.
quadratic
Involving a squared letter, like x squared.x squared plus 3x plus 2 is quadratic.
straight line
A line that does not bend.A ruler draws a straight line.
add
Put numbers together to find the total.Add 3 and 4 to get 7.
exponential
Growing or shrinking by multiplying by the same number again and again.Money in a bank grows exponentially.
gradient
How steep a line is. Up divided by across.A line going up 2 for each 1 across has gradient 2.
positive
Greater than zero.7 is a positive number.

Preview You are reading the start of this lesson. The rest opens with a plan. See plans Already paid? Sign in

Warm-up

Three quick ones from earlier work. Try each in your head or on paper before you open the answer.

  1. From Year 9: a line has gradient 2 and passes through (0, 5). Find y when x = 4.
    Answer13. 5 + 2 × 4.
  2. From Lesson 1: in y = 8 × 1.5x, what is y when x = 2?
    Answer18. 8 × 2.25.
  3. From Year 10: in y = x2 + 3x, find y when x = 4.
    Answer28. 16 + 12.
Words used in this lesson
first difference
a value minus the one before it. For example: the gaps in a column of y-values.
second difference
a difference of the first differences. For example: constant for a quadratic.
ratio
a value divided by the one before it. For example: constant for an exponential.
regression
finding the best-fitting function for data, usually with technology. For example: a GDC fit.
residual
the data value minus the model value. For example: above the line is positive.
extrapolation
using a model outside the range of the data. For example: predicting far ahead.

Visits to a website

A bookshop in Cape Town starts an advertising campaign and counts the visits to its website each day for the next few days: 40, 52, 68, 88, 112 and 141. A student says “it is going up by about 12 a day, so it is a line”.

Predict first: would a straight line, a curve that bends up, or something else fit better? What number would you work out from the table to decide? Use the first figure to see the check on four different data sets, then the second figure to see how a fit is judged.

xydiff 1diff 2ratio041721031341651931.7531.4331.331.2331.190000
straight linefamily that fits
3the constant value

Data set 1: y = 4, 7, 10, 13, 16, 19. The first differences are all 3, so a straight line fits.

Show me the steps
  1. Data set 1: the first differences are 3, 3, 3, 3, 3. They are constant, so the model is a straight line with gradient 3.
  2. Data set 2: the first differences are 3, 5, 7, 9, 11 and the second differences are all 2. A constant second difference means a quadratic, with a = 2 ÷ 2 = 1.
  3. Data set 3: the differences are 4, 6, 9, 13.5 and 20.25, not constant, but every ratio is 12 ÷ 8 = 1.5. A constant ratio means an exponential. Data set 4 has no constant row, so none of these three fits exactly.

Choose the family from the table, then fit it.

  • Equal steps in x (x goes up by 1 each row). If the first differences are constant, fit a line: the gradient is the difference.
  • If the second differences are constant, fit a quadratic y = ax2 + bx + c with a = (second difference) ÷ 2, when x goes up by 1 each row.
  • If the ratios are constant, fit an exponential y = a × bx with b = the ratio.
  • A residual is data value minus model value. A good fit has small residuals with no pattern.

A GDC finds the parameters quickly, but the table tells you which family to ask for.

Read what Keith says

Choose the family from the table, then fit it. Look at how the values change for equal steps. If the first differences are constant, it is a line. If the second differences are constant, it is a quadratic. If the ratios are constant, it is an exponential, and the factor is the ratio. A residual is the data value minus the model value, and a good fit leaves small residuals with no pattern. Try computing differences and ratios for any table before you reach for the calculator.

123456051015
39sum of the residuals
275sum of the squared residuals

Line y = 1x + 0: the residuals are 5, 4, 6, 7, 7, 10. Their sum is 39 and the sum of their squares is 275.

Show me the steps
  1. Line y = x: every residual is positive (5, 4, 6, 7, 7, 10), so the line is below every point. The squares add to 275.
  2. Set the gradient to 2 with c = 0: the residuals are 4, 2, 3, 3, 2, 4 and the squares add to 58. The line is still below every point, so raise c.
  3. Set c = 3: the residuals are 1, −1, 0, 0, −1, 1. They add to 0 and their squares add to 4, which is the smallest value any setting can give.

A good fit inside the data is not a promise outside it. A quadratic that fits six weeks of data may be negative at week 20; an exponential may grow past any real limit. Use the model for values between the data (interpolation) with care, and outside it (extrapolation) only with a reason. Also, residuals that add to zero do not show a good fit: look at the squares.

The rest of this lesson is in the full course

Still to come in this lesson:

  • Worked examples
  • Check before you go on
  • Your turn

In the full lesson every figure moves as you drag it, and every answer you type is checked, with a note on what each wrong answer means.

Years 7 to 11 plan$59Every lesson from Year 7 to Year 11, so the refresher links always open, and every Year 7 to 11 revision pack, for the whole family. $59 for 12 months or $99 for 2 years.
IB Diploma plan$99Every lesson from Year 7 to the IB Diploma, AA and AI, SL and HL, for the whole family. $99 for 12 months or $149 for 2 years.

One plan opens every Diploma lesson, AA and AI, SL and HL, for the whole family.

One payment. Nothing renews. Full refund within 30 days. Prices are in US$; Gumroad shows your local currency at checkout. Pay by card on Gumroad, then come back here and type the email you paid with: we email you a sign-in link. For a refund, reply to your Gumroad receipt or email hello@ksmaths.com.

Try a free sample lesson in every unit, and the whole Skill Tree. See this unit.

Already have a revision pack or the Years 7 to 11 plan? Move up and the unused part of what you paid comes off.

Teaching students who need extra support? Student codes for 5, 10 or 30 students.

Year 11 revision pack, $19BuyPlan $59