To fit a simple model to data, you choose a rule, usually a straight line y = mx + c, and set its numbers so that the line passes close to the supplied points. You then test the rule against every point, not only the ones you used to build it.
This lesson follows defining variables and assumptions in International Mathematics modelling. Once you can fit a model, you can start reading what its numbers mean.
How do you fit a line by hand?
- Check the pattern. For equal steps in x, see whether y changes by about the same amount each time. If it does, a straight line is reasonable.
- Pick two points that are far apart and work out the gradient: change in y divided by change in x.
- Find the intercept. Substitute one point into y = mx + c and solve for c.
- Write the model with variable names and units.
- Test it on all the other points and record the gaps.
The gaps tell you how good the model is. If they are small and scattered on both sides of zero, the line is a fair description.
Worked example
A student measures a plant’s height h (cm) each week w. The readings are:
| w (weeks) | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| h (cm) | 3.1 | 4.9 | 7.2 | 8.8 | 11.1 |
Fit a straight-line model and test it.
Step 1, pattern: the heights rise by 1.8, 2.3, 1.6 and 2.3. They are not identical, but they stay close to 2, so a line is reasonable.
Step 2, gradient using the first and last points: (11.1 − 3.1) ÷ (5 − 1) = 8.0 ÷ 4 = 2.0.
Step 3, intercept: h = 2w + c. Using (1, 3.1), 3.1 = 2 + c, so c = 1.1.
Step 4, model: h = 2w + 1.1, with h in cm and w in weeks.
Step 5, test on the middle points:
| w | Model h | Observed h | Gap (observed − model) |
|---|---|---|---|
| 2 | 5.1 | 4.9 | −0.2 |
| 3 | 7.1 | 7.2 | +0.1 |
| 4 | 9.1 | 8.8 | −0.3 |
The gaps are small and fall on both sides of zero, so the line describes the data well. Check: at w = 5 the model gives 2 × 5 + 1.1 = 11.1, which matches the last reading exactly.
The mistake to watch for
A common slip is to build the line from the first two points only and stop there.
Mistaken model: using (1, 3.1) and (2, 4.9), the gradient is 1.8, and c = 3.1 − 1.8 = 1.3, so h = 1.8w + 1.3.
At w = 5 this predicts 1.8 × 5 + 1.3 = 10.3, but the student measured 11.1.
Two neighbouring points sit close together, so a small measuring error changes the gradient a lot. One test at the end would have exposed it. The correction is to choose points that are far apart and then test the model against all the other readings before trusting it.
Check yourself
Try these without a calculator, then open each answer.
1. The data are (0, 50), (2, 42) and (5, 30). Find a linear model y = mx + c and check it against the point you did not use.
Show answer
Using (0, 50) and (5, 30): gradient = (30 − 50) ÷ 5 = −4, and c = 50. Model: y = 50 − 4x.
Test with x = 2: 50 − 8 = 42, which matches the data.
2. A line passes through (1, 7) and (4, 19). Find its equation and check it with both points.
Show answer
Gradient = (19 − 7) ÷ (4 − 1) = 12 ÷ 3 = 4. Then 7 = 4 × 1 + c, so c = 3. Model: y = 4x + 3.
Check: x = 1 gives 7, and x = 4 gives 16 + 3 = 19. Both match.
3. Data: (1, 2), (2, 5), (3, 10). Is a straight line a good model? Give a reason.
Show answer
No. The rises are 3 and then 5, so the gradient is not constant. The data are curved. In fact y = x² + 1 fits all three points: 1 + 1 = 2, 4 + 1 = 5 and 9 + 1 = 10.
Where this leads next
Once you have a fitted line, the next skill is saying what its numbers mean in context: interpret parameters with units. Mixed questions are in the modelling practice set, and the non-calculator working trainer can check your gradient arithmetic.
Some students fit the line correctly but skip the testing step that earns the final mark. That pattern is what our teachers work on in online one-to-one Mathematics tuition.