STAT117: Introduction to Statistics
There are several common reasons to transform data:
1 = Agree and 5 = Disagree) to (1 = Disagree and 5 = Agree);The central question is: How does a transformation affect the distribution of a variable?
Specifically, we want to consider what happens to:
A linear transformation has the form
\[ \text{new data} = K*(\text{old data}) + C, \]
where K and C are constants.
K represents a scale factorC represents a location shiftExamples:
new = 2(old) + 3 (scale everything up by 2; shift everything to the right by 3)
new = -1.5(old) - 10 (scale factor = -1.5; shift everything to the left by 10)
new = (old)/10 (scale factor = 1/10, no location shift)
Location statistics mimic the transformation:
\[ \text{new statistic} = K*(\text{old statistic}) + C \]
This rule applies to the mode, median, and mean.
For example, if the original mean is 20 and new = 3*(old) + 4, then
\[ \text{new mean} = 3*(20) + 4 = 64. \]
If the original median is 15 and new = -2*(old) + 5, then \[
\text{new median} = -2*(15) + 5 = -25.
\]
Spread statistics are affected by the magnitude of K, but not by C:
\[ \text{new spread} = |K|*(\text{old spread}) \]
This rule applies to the range, IQR, and standard deviation.
Note 1: These statistics are always positive, hence the absolute value in the formula.
Intution: the spread of a distribution is a measure of distance, which is always positive: the distance from my house to Drew is 2 miles, and the distance from Drew to my house is also 2 miles. You would never say that the distance from my house to Drew is “-2 miles.”
Note 2: The location shift C does not affect the spread of the distribution.
Intuition: if you move the entire distribution to the right or left, the distance between the values does not change (neither does the shape, so C also does not affect the skewness ratio).
For example, if the original data has a min of 0 and max of 4, then the range is 4. If new = 2*(old) + 3, then the new min is 3 and the new max is 11, so the new range is 8, or simply |2|(4) = 8. If new = -3*(old) + 4, then the new min is 4 and the new max is -8, so the new range is 12, or simply |-3|(4) = 12.
If the original standard deviation is 5 and new = -3*(old) + 4, then
\[ \text{new SD} = |-3|(5) = 15. \]
The skewness ratio is affected only by the sign of K:
\[ \text{new skewness ratio} = \begin{cases} \text{old skewness ratio}, & K > 0 \\ -\text{old skewness ratio}, & K < 0 \end{cases} \]
In other words, multiplying by a positive number does not change the skewness ratio. Multiplying by a negative number reverses the sign of the skewness ratio.
Intuition: imagine a distribution with a range of 0 to 10. If you multiply by 2, the range becomes 0 to 20, but the shape is the same. If you multiply by -2, the range becomes -20 to 0. The old minimum becomes the new maximum, and the shape is reversed: left skewed becomes right skewed, and right skewed becomes left skewed.
The conversion from Celsius to Fahrenheit is
\[ F = \frac{9}{5}C + 32. \]
Suppose a set of Celsius temperatures has mean 14.6, standard deviation 5, IQR 7, range 20, and skewness ratio 0.8. Calculate the corresponding Fahrenheit statistics.
| Statistic | Celsius | Fahrenheit |
|---|---|---|
| Mean | 14.6 | |
| Standard deviation | 5 | |
| IQR | 7 | |
| Range | 20 | |
| Skewness ratio | 0.8 |
In addition, as a review, what does the skewness ratio tell us about the shape of the distribution?
| Statistic | Celsius | Fahrenheit |
|---|---|---|
| Mean | 14.6 | 58.28 |
| Standard deviation | 5 | 9 |
| IQR | 7 | 12.6 |
| Range | 20 | 36 |
| Skewness ratio | 0.8 | 0.8 |
K = 9/5 is positive. The skewness ratio of 0.8 indicates that the distribution is roughly symmetric.
\[ \text{new data} = -2*(\text{old data}) + 5. \]
If the old mean is 3, the old standard deviation is 1.5, the old IQR is 2, and the old skewness ratio is 2.4, calculate the new statistics.
| Statistic | Old data | New data |
|---|---|---|
| Mean | 3 | |
| Standard deviation | 1.5 | |
| IQR | 2 | |
| Skewness ratio | 2.4 |
In addition, what does the skewness ratio tell us about the shape of the distribution?
| Statistic | Old data | New data |
|---|---|---|
| Mean | 3 | -2(3) + 5 = -1 |
| Standard deviation | 1.5 | |-2|(1.5) = 3 |
| IQR | 2 | |-2|(2) = 4 |
| Skewness ratio | 2.4 | -2.4 |
K reverses the direction of the distribution. The skewness ratio of the old distribution, 2.4, indicates that the distribution is severely right-skewed. The new skewness ratio of -2.4 indicates that the distribution is severely left-skewed. The shape is reversed because we multiplied by a negative number.
Use the NELS variable ses, Socio-Economic Status, and define
\[ \text{SESNEW} = -2*(\text{SES}) + 5. \]
As practice, open the NELS dataset in Jamovi and verify the listed summary statistics for ses. Then, use the transformation rules to calculate the summary statistics for SESNEW.
| Statistic | ses |
SESNEW = -2*(ses) + 5 |
|---|---|---|
| Mean | 18.434 | |
| Median | 19 | |
| Standard deviation | 6.924 | |
| IQR | 10.25 | |
| Range | 35 | |
| Skewness ratio | -1.03 |
| Statistic | ses |
SESNEW = -2*(ses) + 5 |
|---|---|---|
| Mean | 18.434 | -31.868 |
| Median | 19 | -33 |
| Standard deviation | 6.924 | 13.849 |
| IQR | 10.25 | 20.5 |
| Range | 35 | 70 |
| Skewness ratio | -1.03 | 1.03 |
Suppose a Likert scale variable measures agreement with the statement “I like statistics”:
1 = Strongly Agree2 = Agree3 = Neither agree nor disagree4 = Disagree5 = Strongly DisagreeIts summary statistics are mean = 2.56, median = 2, IQR = 2, and skewness ratio = 2.11.
We want to recode the variable so that high scores correspond to more interest in statistics:
1 = Strongly Disagree2 = Disagree3 = Neither agree nor disagree4 = Agree5 = Strongly AgreeWrite down the linear transformation to do so.
What are the mean, median, IQR, and skewness ratio of the transformed variable?
| Statistic | Original scale | Reversed scale |
|---|---|---|
| Mean | 2.56 | |
| Median | 2 | |
| IQR | 2 | |
| Skewness ratio | 2.11 |
The linear transformation is
\[ \text{new} = -1*(\text{old}) + 6. \]
| Statistic | Original scale | Reversed scale |
|---|---|---|
| Mean | 2.56 | -1(2.56) + 6 = 3.44 |
| Median | 2 | -1(2) + 6 = 4 |
| IQR | 2 | |-1|(2) = 2 |
| Skewness ratio | 2.11 | -2.11 |
We want to standardize data so that we can compare scores regardless of their original unit or scale.
| Test | Raw score | Mean | SD |
|---|---|---|---|
| SAT | 1400 | 1100 | 150 |
| ACT | 28 | 25 | 2 |
(1400 - 1100) / 150 = 2. Jerry’s ACT z-score is (28 - 25) / 2 = 1.5. Tom scored higher relative to test-takers on his exam.
SES score of student ID 1 is 23. How do we make sense of this value? What about for student with ID 2?SES = 23 and student 2 has SES = 20. Using the SES mean of 18.434 and standard deviation of 6.924, their z-scores are approximately (23 - 18.434) / 6.924 = 0.66 and (20 - 18.434) / 6.924 = 0.23. Both are above the mean; student 1 is farther above it.
The formula for calculating a z-score is:
\[ \textit{z-score} = \frac{\textit{raw score} - \textit{mean}}{\textit{sd}} \]
To convert a z-score back to the raw score: \[ \textit{raw score} = \textit{z-score} \times \textit{sd} + \textit{mean} \]
For example, the z-score for SES is calculated as
\[ z_{SES} = \frac{\text{SES} - 18.4}{6.92} \]
The z-score is a linear transformation because it can be written as z_SES = (1/6.92)*SES - 18.4/6.92, which has the form K*(old data) + C.
1/6.92 is positive; for SES, it is approximately -1.03.Interpretation examples:
If z-score is 0.7: The raw score is 0.7 standard deviations ABOVE the mean.
If z-score is -1.2: The raw score is 1.2 standard deviations BELOW the mean.
achmat10) and the reading achievement test (achrdg10). The mean and standard deviation values for each variable can be found using Jamovi - Analyses - Exploration - Descriptives.| Test | Student score | Mean | SD |
|---|---|---|---|
Math (achmat10) |
53 | 57 | 7.84 |
Reading (achrdg10) |
53 | 56.1 | 8.30 |
achmat10). Is this a good score? What is the student’s raw score?Math: (53 - 57) / 7.84 = -0.51.
Reading: (53 - 56.1) / 8.30 = -0.37.
She did better relative to peers on reading: its z-score is higher (less below the mean).
The empirical cumulative percentages in NELS are 28.6% for math and 32.0% for reading, so reading is also higher by cumulative percentage.
2.1*7.84 + 57 = 73.464, or about 73.5.
The following information are given in the NBAPlayers2024 data from Statistics: Unlocking the Power of Data.
LeBron James
| Statistic | Raw score | Mean | SD | z-score |
|---|---|---|---|---|
| Rebounds per game | 7.30 | 5.11 | 2.41 | |
| Field-goal percentage | 0.540 | 0.478 | 0.062 | |
| Three-point percentage | 0.410 | 0.350 | 0.075 |
Stephen Curry
| Statistic | Raw score | Mean | SD | z-score |
|---|---|---|---|---|
| Rebounds per game | 4.46 | 5.11 | 2.41 | |
| Field-goal percentage | 0.450 | 0.478 | 0.062 | |
| Three-point percentage | 0.408 | 0.350 | 0.075 |
| Player | Rebounds z-score | Field-goal z-score | Three-point z-score |
|---|---|---|---|
| LeBron James | (7.30 - 5.11) / 2.41 = 0.91 |
(0.540 - 0.478) / 0.062 = 1.00 |
(0.410 - 0.350) / 0.075 = 0.80 |
| Stephen Curry | (4.46 - 5.11) / 2.41 = -0.27 |
(0.450 - 0.478) / 0.062 = -0.45 |
(0.408 - 0.350) / 0.075 = 0.77 |
What kind of z-score values would be considered unusual?
Exercise: pick a numeric variable from the NELS dataset and calculate the raw scores for the following z-scores.
| z-score | raw-score |
|---|---|
| 0 | |
| -0.5 | |
| 1.5 | |
| -4.5 | |
| 12.5 |
For an example, use SES, with mean 18.4 and standard deviation 6.92. Convert each z-score with raw score = z-score*6.92 + 18.4:
| z-score | Example SES raw score |
|---|---|
| 0 | 18.40 |
| -0.5 | 14.94 |
| 1.5 | 28.78 |
| -4.5 | -12.74 |
| 12.5 | 104.90 |
For many numerical variables, it is unlikely to be more than 2 SD’s away from the mean (4.5% chance if the distribution is normal – more on this later).
As a result, if a z-score is greater than 2 or less than -2, we could consider the corresponding raw score as an outlier.
The distribution of z-scores for any variable would have a mean of 0 and a standard deviation of 1 (by definition).
Because the definition of a z-score involves the mean and standard deviation, it only really makes sense to talk about z-scores with numeric variables.
We can use z-scores to determine outliers. For instance, we can call a raw score an outlier if its z-score is greater than 2 or less than -2.
We can standardize a variable using:
- z-score
- cumulative percentage (i.e., percentile rank)