Shifting data is adding a constant k to each member of a data set, where k is a real number. In visual terms, it is lifting the entire distribution of data points and shifting *en masse* a distance of k.

## Shifting Data and the Mean & Median

When data is shifted the mean(μ) and median are shifted by the constant k.

That is to say, when you shift a data set by k, so that f(x)= x+k for every x in your data set,

- f(μ)= μ + k
- f(med)= med + k

Note that k can be either positive or negative.

## Measures of Spread and Relative Standing

Your standard deviation, variance, z scores and percentile values all remain unchanged when your data set is shifted. Since every point in your data set moves the exact same distance, there is no change in their relations to each other.

## An Example of Shifting Data

Suppose that you were running a research project on the items people packed into USPS #4 Priority Mail Box. You collect your data and do your analysis, and then realize that although you’ve worked with the net weights only the contents of the boxes are significant to your research. Suppose your measurements are in ounces. Since each box weighs 5 ounces, k= -5.

- If your mean was 41 before the shift, it is now 36.
- If your median was 28, it is now 23.
- If your standard deviation was 16, it is still 16.
- Your variance will stay the same, as will your z score.

## Shifting Data and Rescaling

There are some cases when you may have to do both a data shift and a rescale—for instance, when you need to change temperature readings from Fahrenheit to Celsius degrees, where the temperature in Fahrenheit, F = [(9/5)*C]+32.

In this case, first shift your data by k= -32, and apply this additive constant to your mean and median. The standard deviation and variance will remain unchanged for this step. Then rescale, and multiply your mean and standard deviation by the rescaling constant 5/9 to find the mean and standard deviation for your data set in Celsius.

Sources:

https://www.cs.princeton.edu/courses/archive/fall08/cos436/Duda/PR_Mahal/scaling.htm

http://www.cs.xu.edu/math/math116/12f04/Ch06.pdf

https://www.stt.msu.edu/academics/classpages/uploads/SS15/200-4/Chapter6.pdf

If you prefer an online interactive environment to learn R and statistics, this *free R Tutorial by Datacamp* is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try *this Statistics with R track*.

*Facebook page*and I'll do my best to help!