A LevelEdexcel

Coding Revision


(Note: This topic is Edexcel only.)

Coding is where something is done to every data value to make them easier to work with. Indeed, we can add, subtract, multiply and divide our data values, and as long as we do the same thing to each data value, the mean and standard deviation of the new set can tell us the mean and standard deviation of the original values.

There are three skills you need to know for coding.

A LevelEdexcel

Skill 1: Coding With Raw Data

To code a data point x, we turn it into y=\dfrac{x-a}{b} where a and b are of our choosing. Then we can work with our new data set y to get information about our original x.

Recall notation: \text{mean of }x=\bar{x} and \text{variance of }x= \text{var}(x)

To get information about x from our coded set y, we have the following formulas:




Example: Find the mean and variance of 14010,14030,14040,14060

If we use the coding y=\dfrac{x-14000}{10} we get y=1,3,4,6, which is much easier to work with.

So, find the mean and variance of the y values:




Then, find the mean of the original values:





and the variance of the original values:




So the mean and variance of 14010,14030,14040,14060 is 14035 and 325

A LevelEdexcel

Skill 2: Coding With Summarised Data

We can also apply coding to simplify summarised data to calculate the mean and variance.

Example: Suppose we have \sum{(x-100)}=18 and \sum{(x-100)^{2}}=45 with ten data points.

The obvious coding to try is y=x-100

This gives \sum{y}=18 and \sum{y^{2}}=45


So, the mean and variance of the y values are:




This gives results of:

\bar{x}= \bar{y} +100 = 1.8 + 100 = 101.8


\text{var}(x)= \text{var} (y) = 1.26

(the variance of x is the same as the variance of y, since we only subtracted 100 from each number).

A LevelEdexcel
MME Logo

Your 2024 Revision Partner


Open TikTok

Skill 3: Coding With Grouped Data

We can code grouped data by coding the midpoint and calculating all our sums with the coded midpoint, then converting back at the end.

Example: Estimate the mean and variance of the heights of the teachers at a school from the following table.

Step 1: Find the midpoints.

Step 2: Choose a suitable coding for the midpoints. Here we should go for y=\dfrac{x-1.55}{0.1}. Now add the coded midpoints to the table.

Step 3: Proceed normally with the coded values, by adding an fy column and an fy^{2} column to the table.

Step 4: Calculate the mean and variance estimates for y.


\text{var}(y) =\dfrac{191}{50}-1.74^{2}=3.82-3.0276=0.7924


Step 5: Use the coding formulas to turn these into values for x.







A LevelEdexcel

Coding Example Questions

A suitable coding would be y=\dfrac{x-1000}{10}, which gives y=0,1,3,4,7 as the new data set.














\text{var}(x) is the variance, while the question asked for standard deviation.

\sigma=\sqrt{600}=24.5 (3 sf)

Clearly, we should use the encoding y=\dfrac{x-4}{12} to get:








Now convert back to x:








Step 1: Find the midpoints of each class and add them to the table.



Step 2: Choose a suitable coding. In this case, there are a few possibilities, but the one shown here is y=\dfrac{x-1725}{25}.


Step 3: Proceed to create the rest of the table, with an fy and an fy^{2} column.



Step 4: Calculate the mean and variance for y.




Step 5: Convert back into x values.







\text{var}(x)=7529.6875 or 7530 to 3 significant figures.

Additional Resources


Exam Tips Cheat Sheet

A Level

Formula Booklet

A Level

You May Also Like...

MME Learning Portal

Online exams, practice questions and revision videos for every GCSE level 9-1 topic! No fees, no trial period, just totally free access to the UK’s best GCSE maths revision platform.

View Product