Tutorials › Introduction to Statistics › Adding a Constant to Every Observation

Center, Spread and Position · Tutorial 163 of 996

Adding a Constant to Every Observation

See why shifting every observation by the same amount changes the distribution’s location but not its spread.

Beginner 8 min read

What You'll Learn

  • Write the transformed observations as the original values plus a constant.
  • Find how the mean, median, and quartiles change after a shift.
  • Explain why variance and standard deviation remain unchanged.
  • Determine why the interquartile range is unchanged.
  • Apply the results when observations are reported on a shifted scale.
  • Avoid confusing a change in location with a change in spread.

Introduction

Adding the same amount to every observation moves an entire data set along the number line. For example, if every recorded time is increased by 5 minutes, the observations are all larger, but the distances between them do not change. This simple transformation gives a useful distinction: measures of center shift with the data, while measures of spread do not.

The result applies to the mean, median, quartiles, variance, standard deviation, and interquartile range. We will write the relationship precisely, explain why it holds, and work through examples.

Defining a Constant Shift

Suppose a data set contains \(n\) observations \(x_1,x_2,\ldots,x_n\). Choose a fixed constant \(c\), and define a new observation for each original one by \(y_i=x_i+c\). The same \(c\) is used for every observation. If \(c\) is positive, each value increases; if \(c\) is negative, each value decreases.

Definition: Adding a constant \(c\) to every observation transforms \(x_i\) into \(y_i=x_i+c\) for each \(i=1,\ldots,n\). The constant has the same units as the observations. For example, adding 5 to times measured in minutes means adding 5 minutes to every time.

For a population, we use its population mean \(\mu\), variance \(\sigma^2\), and standard deviation \(\sigma\). For a sample, we use its sample mean \(\bar{x}\), sample variance \(s^2\), and sample standard deviation \(s\). The formulas for the two variances have different denominators, but both are based on squared deviations from the corresponding mean.

Theorem: After adding \(c\) to every observation, the mean, median, and each quartile increase by \(c\). The population variance, sample variance, population standard deviation, sample standard deviation, and interquartile range remain unchanged.

For quartiles, this result assumes the same quartile convention is used before and after the shift. Under the median-of-halves method, for instance, the ordering of values stays the same and the values used to calculate each median all increase by \(c\). Standard interpolation-based quartile methods also preserve this shift because the interpolation weights sum to 1.

Why the Measures Change or Stay the Same

The mean changes by \(c\) because adding \(c\) to each of \(n\) values increases their total by \(nc\), and the mean divides that total by \(n\). For spread, the key fact is that each observation’s deviation from the mean is unchanged: both the observation and the mean increase by \(c\). Thus every squared deviation is unchanged, as are the variance and standard deviation derived from those deviations.

$$ \bar{y} =\frac{1}{n}\sum_{i=1}^{n}(x_i+c) =\frac{1}{n}\left(\sum_{i=1}^{n}x_i+nc\right) =\bar{x}+c, \qquad y_i-\bar{y}=(x_i+c)-(\bar{x}+c)=x_i-\bar{x}. $$

The same deviation argument works for a population, replacing the sample mean with \(\mu\). For a sample, the variance divides the sum of squared deviations by \(n-1\); for a population, it divides by \(n\). Since the squared deviations themselves have not changed, either variance stays the same. Taking the positive square root shows that the corresponding standard deviation stays the same too.

A constant shift also preserves the order of the observations. If \(x_i\leq x_j\), then \(x_i+c\leq x_j+c\). Therefore the sorted values, including ties, occur in the same positions after shifting. The median and quartiles are based on these positions and values; each selected value, or average or interpolation of selected values, increases by \(c\). Subtracting the first quartile from the third gives the interquartile range:

$$ Q_{1,\text{new}}=Q_1+c,\qquad Q_{3,\text{new}}=Q_3+c,\qquad \mathrm{IQR}_{\text{new}}=(Q_3+c)-(Q_1+c)=Q_3-Q_1. $$

Worked Examples

Worked Example: Adding Five to Every Observation

Consider the hypothetical sample of eight quiz scores, measured in points: \(12,14,15,18,20,21,23,25\). Add 5 points to every score. Compare the centers and spreads before and after the shift, using the median-of-halves method for the quartiles.

The transformed scores are \(17,19,20,23,25,26,28,30\). The original mean is

$$ \bar{x}=\frac{12+14+15+18+20+21+23+25}{8} =\frac{148}{8}=18.5\text{ points}. $$

The new mean is \(\bar{y}=18.5+5=23.5\) points. The original median is the average of the fourth and fifth ordered scores, \((18+20)/2=19\) points; the new median is \((23+25)/2=24\) points.

The lower half of the original data is \(12,14,15,18\), so \(Q_1=(14+15)/2=14.5\) points. The upper half is \(20,21,23,25\), so \(Q_3=(21+23)/2=22\) points. Thus \(\mathrm{IQR}=22-14.5=7\) points. After adding 5, \(Q_1=19.5\), \(Q_3=27\), and \(\mathrm{IQR}=27-19.5=7\) points.

To check the sample variance directly, the sum of the original squared deviations from the mean is \(42.25+20.25+12.25+0.25+2.25+6.25+20.25+42.25=146\) points squared. Therefore

$$ s^2=\frac{146}{8-1}=20.86\text{ points}^2,\qquad s=\sqrt{20.86}=4.567\text{ points}. $$

The transformed scores have the same deviations from their new mean, so their sample variance is also \(146/7=20.86\) points squared and their sample standard deviation is \(4.567\) points. The shift raises each measure of center by 5 points but leaves each measure of spread unchanged.

Worked Example: Subtracting a Constant

A hypothetical set of five measurements is \(3,7,7,10,13\) units. Subtract 4 units from every observation. Find the original and transformed median and quartiles, and compare the interquartile ranges.

The transformed data are \(-1,3,3,6,9\). In the original set, the median is the middle value, 7 units; in the transformed set, it is 3 units. This is a decrease of 4 units, as expected.

Using the median-of-halves method, exclude the overall median when splitting this odd-sized data set. The original lower half is \(3,7\), so \(Q_1=(3+7)/2=5\) units. The upper half is \(10,13\), so \(Q_3=(10+13)/2=11.5\) units. Hence the original \(\mathrm{IQR}=11.5-5=6.5\) units.

For the transformed set, the lower half is \(-1,3\) and the upper half is \(6,9\). Thus \(Q_1=(-1+3)/2=1\) unit and \(Q_3=(6+9)/2=7.5\) units. The transformed \(\mathrm{IQR}=7.5-1=6.5\) units. Both quartiles have decreased by 4 units, but their difference has not changed.

Worked Example: Removing a Sensor Offset

Suppose a hypothetical sensor reports five readings, in units: \(101,103,104,106,106\). Each reading includes a fixed offset of 100 units. Subtracting 100 from every reading gives adjusted values \(1,3,4,6,6\). Compare the means and sample standard deviations.

The original mean is \((101+103+104+106+106)/5=520/5=104\) units. The adjusted mean is \((1+3+4+6+6)/5=20/5=4\) units, which is 100 units lower.

For the original readings, the deviations from 104 are \(-3,-1,0,2,2\) units. The sum of their squares is \(9+1+0+4+4=18\) units squared, so the sample variance and standard deviation are

$$ s^2=\frac{18}{5-1}=4.5\text{ units}^2,\qquad s=\sqrt{4.5}=2.121\text{ units}. $$

The adjusted readings have deviations from 4 of \(-3,-1,0,2,2\) units as well. Their sample variance is therefore \(18/4=4.5\) units squared, and their sample standard deviation is \(2.121\) units. Removing the fixed offset changes the reported center, not the variability among readings.

What the Result Means in Practice

Adding a constant is a change in the origin of the measurement scale, not a change in the distances among observations. Every pairwise difference is preserved:

$$ y_i-y_j=(x_i+c)-(x_j+c)=x_i-x_j. $$

That is why spread measures based on deviations or differences stay the same. The numerical value of the center changes because the location of every observation changes. Units help keep these statements clear: adding 5 minutes shifts a mean by 5 minutes, while a variance remains measured in minutes squared and keeps its numerical value.

These results are useful when data are recentered, when a fixed offset is removed from measurements, or when a scale uses a different zero point. They do not say that every kind of transformation leaves spread unchanged. Multiplying observations by a constant is a different operation and has different consequences.

Common Mistake

A common mistake is to reason that because every value is larger, the standard deviation and interquartile range must also be larger. That confuses the values’ location with their spread. For example, adding 5 to both 10 and 12 produces 15 and 17: the values have increased, but their difference is still \(17-15=2\). The correction is to ask whether the transformation changes distances between observations. Adding the same constant does not.

Key takeaway: If \(y_i=x_i+c\) for every observation, then the mean, median, and quartiles each increase by \(c\). Variance, standard deviation, and interquartile range stay the same.

Check Your Understanding

Use the constant-shift results to answer these questions.

  1. A data set has mean 18 and sample standard deviation 4. What are the mean and sample standard deviation after adding 3 to every observation?
  2. The original first and third quartiles are 12 and 20. What are they, and what is the interquartile range, after subtracting 5 from every observation?
  3. Explain why the sample variance does not change when the same constant is added to every observation.
  4. A set of temperatures is shifted upward by 2 degrees. Which changes: the median, the standard deviation, both, or neither? Explain.
  5. Why must the same quartile convention be used before and after a shift when comparing reported quartiles?