Data Coding
Coding transforms data with $y = \frac{x - a}{b}$ to make calculations simpler. Means follow the coding exactly; standard deviations ignore the shift $a$ but are scaled by $b$.
Key points
- If $y = \frac{x - a}{b}$ then $\bar{y} = \frac{\bar{x} - a}{b}$ and $\sigma_y = \frac{\sigma_x}{b}$ (for $b > 0$).
- Reverse: $\bar{x} = b\bar{y} + a$ and $\sigma_x = b\sigma_y$.
- Adding or subtracting a constant does not change the spread.
- From coded sums: $\bar{y} = \frac{\sum y}{n}$, $\sigma_y^2 = \frac{\sum y^2}{n} - \bar{y}^2$.
Worked example
Question. $y = \frac{x - 100}{5}$; $\bar{y} = 2.4$, $\sigma_y = 1.2$. Find $\bar{x}$ and $\sigma_x$.
- $\bar{x} = 5(2.4) + 100 = 112$
- $\sigma_x = 5 \times 1.2 = 6$
Answer. $\bar{x} = 112$, $\sigma_x = 6$
Common mistakes
- Adding $a$ to the standard deviation.
- Multiplying the variance by $b$ instead of $b^2$.
- Decoding in the wrong order (multiply by $b$ first, then add $a$).
Related topics
- Sampling & Data Presentation
- Measures, Correlation & Regression
- Probability & Discrete Distributions
- The Binomial Distribution
- Hypothesis Testing
- The Normal Distribution
- Conditional Probability & Set Notation
- Normal Approximation to the Binomial
- Hypothesis Testing for a Normal Mean
- Hypothesis Testing for Correlation
- The Large Data Set: How to Use It