All subjects · Mathematics · WST01 (S1)
Coding
Coding transforms data with a linear rule to make the numbers easier. You must then turn the coded mean and standard deviation back into the original units.
The rule
If y = (x - a)/b then
- ȳ = (x̄ - a)/b, so x̄ = bȳ + a
- σy = σx / b, so σx = bσy (variance: σx2 = b2 σy2)
Adding or subtracting a constant shifts the data but does not change the spread. Multiplying or dividing scales the spread.
Using coded summary statistics
If y = (x - 50)/5 and n = 20, Σy = 36, Σy2 = 98:
ȳ = 1.8, σy2 = 98/20 - 1.82 = 1.66, σy = 1.2884.
Then x̄ = 5(1.8) + 50 = 59 and σx = 5 × 1.2884 = 6.442.
Why code?
Coding makes large or awkward numbers (like 2015, 2018, ... or 1050, 1060, ...) small, which reduces arithmetic errors. Statistics that measure position (mean, median, quartiles) follow the full rule; measures of spread (standard deviation, range, IQR) are only affected by the scaling.
Worked example
y = (x - 50)/5. The coded data have mean 3.2 and standard deviation 1.4. Find the mean and standard deviation of x.
- x = 5y + 50.
- x̄ = 5(3.2) + 50 = 66
- σx = 5 × 1.4 = 7 (the +50 does not change spread)
Answer: x̄ = 66, σx = 7
Check yourself
- y = (x - 50)/5. The coded mean is ȳ = 3.2. Find x̄.
Show answer
66. x̄ = 5 × 3.2 + 50 = 66.
- y = (x - 50)/5. The coded standard deviation is 1.4. Find the standard deviation of x.
Show answer
7. σx = 5 × 1.4 = 7. Subtracting 50 does not affect spread.
- y = (x - 50)/5, n = 20, Σy = 36 and Σy2 = 98. Find the mean of x.
Show answer
59. ȳ = 36/20 = 1.8, so x̄ = 5(1.8) + 50 = 59.
- y = (x - 50)/5, n = 20, Σy = 36 and Σy2 = 98. Find the standard deviation of x. Give your answer to 3 significant figures.
Show answer
6.44. σy2 = 4.9 - 3.24 = 1.66, σy = 1.2884, σx = 5σy = 6.44.
- y = (x - 100)/10 and the variance of y is 2.5. Find the variance of x.
Show answer
250. σx2 = 102 × 2.5 = 250.
- Data have mean 1060 and standard deviation 15. They are coded by y = (x - 1000)/10. Find ȳ.
Show answer
6. ȳ = (1060 - 1000)/10 = 6.
- Every value in a data set is increased by 7. What happens to the standard deviation?
- It increases by 7
- It stays the same
- It is multiplied by 7
- It increases by 49
Show answer
It stays the same. Adding a constant moves every value equally, so the spread is unchanged.
Sources
Last updated 7 November 2026. Spotted a mistake? Tell us.