Practical data lab: error bars and worst fit lines
A worst fit line is the steepest or shallowest straight line that still passes through every error bar on a graph. The difference between the best-fit gradient and the worst-fit gradients gives the uncertainty in the gradient. Our Practical Data Lab takes your readings and repeats, averages them, draws the error bars, and finds the best-fit line, the steepest and shallowest lines, and the gradient and intercept with their uncertainties.
It opens on a spring experiment: load in newtons against extension in centimetres, with three repeats at each load.
Practical Data Lab
Turn readings into error bars, best fit lines and uncertainties
How to use the practical data lab
- Under Readings, name your x and y variables and their units, and choose how many repeats you took, from 1 to 4.
- Type your readings in the table: x in the first column, the repeats of y in the others. Up to 30 rows.
- Under Uncertainty, give the uncertainty in x, and choose how to find the uncertainty in y: half the range of the repeats, a fixed value, or a percentage of the reading.
- Read the graph with its error bars and lines, the gradient and intercept with their uncertainties, and the working.
Values are rounded to match their uncertainty, ready to copy into a write-up.
How the lab finds the uncertainty in the gradient
- Average the repeats at each x to get the mean y.
- Find each error bar: here, half the range of the repeats.
- Draw the best-fit line through the mean points by least squares.
- Draw the steepest and shallowest lines that still pass through every error bar.
- Take half the difference between their gradients as the uncertainty in the gradient, Δm = (m_max − m_min) ÷ 2.
If no straight line passes through every error bar, the lab joins opposite ends of the first and last bars instead, and says so. AQA's practical handbook uses a single worst line instead: percentage uncertainty = |best gradient − worst gradient| ÷ best gradient × 100. Both methods give similar answers; use the one your course asks for.
Worked example: a spring
At a load of 1 N, the three extensions are 1.8, 2.6 and 2.2 cm. The mean is 2.2 cm and half the range is (2.6 − 1.8) ÷ 2 = 0.4 cm, so the point is 2.2 ± 0.4 cm. The lab does this for all six loads, then finds:
| Line | Gradient (cm/N) | Intercept (cm) |
|---|---|---|
| Best fit | 1.99 | 0.23 |
| Steepest through every bar | 2.37 | −0.81 |
| Shallowest through every bar | 1.63 | 1.13 |
With a single worst line, as AQA does it, the percentage uncertainty would be 19% using the steepest line or 18% using the shallowest. Quoted to match its uncertainty, the gradient is 2.0 ± 0.4 cm/N and the intercept 0.2 ± 1.0 cm. The intercept is within its uncertainty of zero, as Hooke's law expects. The spring constant is the inverse of this gradient: k = 1 ÷ 1.99 cm/N = 0.503 N/cm, or about 50 N/m, with the same 18.6% uncertainty, so k = 50 ± 9 N/m. Our spring constant guide covers Hooke's law.
Check yourself:
What the lab does not do
- Straight lines only. For a curve, rearrange the equation into a straight-line form first, such as T² against l for a pendulum, and plot that.
- No combined uncertainties in formulas. To carry the gradient's uncertainty into a final answer, add percentage uncertainties by hand, as in the spring example.
- One y column per reading. Up to four repeats of y, and one x value per row.
Common mistakes
- Including an anomaly in the mean. Leave out a repeat that is clearly wrong before averaging, and say why in your write-up.
- Drawing the worst line through the points, not the bars. It must pass through every error bar, at its extremes.
- Quoting too many figures. Round the uncertainty to one significant figure (two if it starts with 1), then round the value to the same decimal place.
- Forgetting units on the gradient. The gradient's unit is the y unit over the x unit, here cm/N.
Learn more
Our percentage uncertainty guide covers combining uncertainties, and the Linear Regression Calculator fits a line to data without error bars.
Common questions
What is a worst fit line?
How do you calculate the uncertainty in a gradient?
How do you find the uncertainty from repeat readings?
What is the percentage uncertainty in the gradient?
What if no line passes through every error bar?
How do you round a value with its uncertainty?
Revision cards
Say the answer first, then flip the card to check it.
Where to go next
- Solve it
Practical Data Lab
Turn readings into error bars, best fit lines and uncertainties
Open the tool