# Virtual Monday Aug 31

Welcome to Virtual Monday 2!

This week we’ll be trying out a “blog” format for what we need to learn – let’s crack into it!

# Measures of Variability

## What Are These?

Measures of variability – range, standard deviation, and variance – are descriptive statistics that explain how spread out a set of observations are from each other (in other words, how much they vary).

## Why Do We Need These?

We learned last week about the mean, median, and mode as measures of central tendency, but this week we’ll add another type of descriptive statistic – measures of variability – to help us with reporting a “complete picture” of the dataset we’re summarizing. Measures of central tendency are great for summarizing where the center or typical score in our dataset is, but that alone will tell us nothing about how spread out the data is; so that’s where measures of variability come in.

To put it in more concrete terms, let’s think about exam scores. Suppose you learn that the average score on an exam you took last week was 75%. However, you know that’s limited information. Just because the average was 75% doesn’t mean you scored that – maybe you scored much lower, or much higher. That’s where a measure of variability will be helpful – if you also found out the range of test scores was 70% to 94%, then you’d know the full range of scores you might’ve earned. Or, if the range was 0% to 94%, that’s helpful to know, too (though a bit more nerve-wracking to find out, probably!).

But in either case, knowing the range of scores (instead of only knowing the mean) gives you a much better sense of what that dataset (i.e., everyone’s exam scores) looks like.

# The 3 Measures of Variability: Range, Standard Deviation, and Variance

Just as we had three measures of central tendency (mean, median, mode), we have three measures of variability that we commonly use.

## Range

The range is the difference between the highest and lowest scores observed in a sample. If the lowest test score in the exam example was 52% and the highest was 99%, then your range is (52%, 99%) or 52% to 99%.

The range gives a helpful overall idea of how far the scores are spread out, but it ignores everything else about a dataset. For example, the range won’t tell you whether a lot of people scored lower (e.g., lots of scores near that 52% minimum) or more scored higher (closer to 99%). So, think of the range as a good starting point, but we usually want to know more about how ALL of the scores are spread out, instead of only knowing about the one lowest and one highest score.

## Standard Deviation (s or SD)

That’s where our second measure of variability, the standard deviation, comes in. Standard deviation will help us describe the overall variability among ALL the scores in the dataset, so it’s very helpful to report.

Specifically, the standard deviation is the average of the differences of each observation from the mean. For example, let’s say we have a dataset with just three scores {1, 3, 5}. The mean of that dataset would be (1+3+5)/3 = 3. Then, each score in the dataset would be either 2 points “away” from the mean (1 is 2 points away from the mean of 3; so is 5) or 0 points away from the mean (the score of 3 is 0 points away from the mean of 3). And the standard deviation will help us summarize that all of the observations in that dataset are, on average, about 1.3 points away from the mean. The concept captured by standard deviation is the average distance of every score in the dataset from the average.

But, the standard deviation in the case of the {1, 3, 5} dataset won’t be exactly 1.3… We have to make a couple of tweaks to the calculation of standard deviation to make it work properly across a lot of different situations, so let’s get into that now, and we’ll come back to this example to get the correct standard deviation.

### Calculating Standard Deviation (s or SD)

SD is an incredibly useful calculation that we will use repeatedly all semester, so I want us to break down how this formula works in detail. (This is also the formula that I will get tattooed on my body if our class earns an 85.0% average! It’s so beautiful… You’ll see!)

If we are thinking about how much scores vary in a dataset and want to capture that, we can start with the idea of comparing each score to a fixed point, such as the mean. As a formula, that’s xix, or each individual score (xi) minus the mean (x). We can call each of these a deviation (because it’s how far each score deviates from the mean). Here are the deviations with our dataset of {1, 3, 5}.

Now, we would need to report only one number as our standard deviation, so let’s think about summarizing that. If we added up or averaged our deviations of {-2, 0, 2}, we’d get 0. And we know there’s more than 0 variability here, so we need to add in a few other calculations to get this formula working as a summary of the data’s variability.

One way to make sure our deviations don’t add up to 0 is to square each of them. (We could also take their absolute value to resolve this issue, but that gets us a different measure of variability than standard deviation that’s less commonly reported.) Once we square each deviation and sum that up, we will get a non-zero measure of variability. Yay! Let’s try that with the same data from above.

Now if we sum these, we will have have the sum of squared deviations. Expressed as a formula, that’s Σ(xix)2 = 4 + 0 + 4 = 8. This is starting to give us a better idea of how much variability there is in our data – it’s definitely more than zero, which we got before we squared the deviations.

But remember we’re working toward the calculation of the average of the differences of each observation from the mean. And right now we have the sum of squared differences of each observation from the mean.

So first, to get back to this being an average, let’s divide our sum of squares by n to get this to be an average. …actually, though, we’ll divide by n – 1, for reasons I promise to explain in about two more weeks in class. Trust me for now!

In our example, we’ve got a sum of squared deviations = 8, and if we divide by our sample size (3) minus 1, that becomes 8 / 2 = 4. This calculation is a variance, which can be interpreted as the squared average difference of all scores from the mean. But we usually don’t think of “squared” units (e.g., the average difference of test scores squared???), so…

Second, to make this easily interpretable, we “undo” the squaring we needed to do on the individual deviations in the beginning. To do this, we take the square root of our prior calculation, giving us 4 = 2. And, at last, this is our standard deviation. So we can say that for our dataset, {1, 3, 5}, we find that the average difference of all the scores from the mean is 2. (This is the final, correct sample standard deviation, instead of the 1.3 we had before using the proper formula.)

### Recapping the Calculation of SD

That’s a lot of calculations to think through, so let’s make a short summary of what we just did (and why).

1. Calculate deviations for each score from the mean x, (xix).

Deviations always sum to 0, so we…

2. Square each deviation – (xix)2 – and sum those up. (This is the sum of squares. We’ll use this again later in the semester.)

To take sample size into account, we…

3. Divide the sum of squared deviations by n – 1. (This is the variance. We’ll see this term again very, very soon!)

4. Last, to make this easily interpretable (instead of the “squared average difference of scores from the mean”), we take the square root of the variance to get the standard deviation, which is the average difference of all scores from the mean.

Altogether, then, the standard deviation formula is:  As there is more variability in a set of scores (as the scores become more spread out), the number you get for standard deviation will increase. If scores are more similar to each other (less spread out), the standard deviation will be a smaller number. If all the scores in a dataset are exactly the same, standard deviation will equal 0.

### Practicing with SD

Let’s do a bit of practice calculating here. Let’s use the two samples included in our slides, from 6 students each on 2 different meal plans. These observations are the number of times each student ate at Servo in a week. Calculate the mean and standard deviation for each group, and interpret both values.

Before you start solving: Notice that the scores in the Meal Plan 2 group are more “spread out” (more very high and very low scores), so we should get a larger standard deviation there, compared to what we get from the Meal Plan 1 group.

You should start by calculating the mean (x) for each group, so that you can then calculate the deviations.

## Meal Plan 2: {0, 0, 1, 9, 10, 10}

You can check your calculations and interpretations with the key here.

## The Third Measure of Variability: Variance (s2)

OK, let’s get back to the big picture. We said there are three common measures of variability. First, we covered the range; second, standard deviation; and let’s talk about the third one, variance.

Oh wait!!! We already covered variance. It was part of our standard deviation calculation. So, wow, you’re impressed already with how much you learned just from that one (brilliant, incredible, amazing, show-stopping) standard deviation formula!

Remember the variance was the next-to-last step in the SD calculation, before we take the square root of everything. So that’s why its notation is s2, because variance is just standard deviation squared.

The formula for the variance is:  Notice this is the exact same as the standard deviation formula, except that there is no square root to calculate at the end. So if you calculate the standard deviation, you’ve already calculated the variance along the way.

While it’s uncommon for us to interpret variance alone (the “squared unit” bit makes it less intuitive for interpretation by itself), variance is used in many other formulas in statistics, and we’ll encounter some of those as we move forward in the semester.

# Summary

There are three measures of variability: range, standard deviation, and variance. We’ll most commonly use the standard deviation, but range is also a helpful way to report the minimum and maximum scores, and variance will come up again in later parts of our class.

One extremely useful application/use of standard deviation is what we’ll learn about next: the Empirical Rule.