Intro to statistics with R - Wrapping up Measures of Variability

Using Jeremy Lin's 10-game scoring stretch from 2012, the instructor calculates variance and standard deviation from raw scores. Lin averaged 22.7 points per game with a standard deviation of 9.6 points, showing typical fluctuation. A single 2-point outlier significantly inflates the variability.
Chapters
Onto an example. This is one of my favorite examples I developed last year because this happened in New York City, which is where I live, and it happened in professional basketball in the US in the NBA. This is a guy called Jeremy Lin who was not that big of a star. Not a star at all, actually. He's not really a top basketball player in the US but all of a sudden, he got the chance to play for the New York Knicks. So there's Jeremy Lin in Madison square Garden. That's right there in the middle of Manhattan, just a couple of blocks from where I live. So I got caught up in what the media called Lynn sanity. Jeremy Lin suddenly took the NBA by storm because he started scoring a lot of points. So what we're going to do is we're going to look at Jeremy Lin's points per game or over that time. It was during the winter of 2012. So what I can do is I can look at Jeremy Lin's points per game across. Let's just pick out a 10 game stretch of that season in 2012. And if you start at the bottom, actually, you'll see there's just two points per game in that one game. And that was typical of what Jeremy Lin was doing before. One of the star players on the Knicks was hurt and Jeremy Lin had the opportunity to play. So Carmelo Anthony, who's one of the stars of the New York Knicks, he was hurt. Jeremy Lin got the opportunity to start, and his first opportunity to start, he scored 25 points. And then the next time he started, he scored 28 points and so on, he scored 23. And I think it was around here when he scored 38 that Linsanity totally set in in New York City. And we got all excited. We thought the Knicks were going to win the NBA championship. Never happened. Not happening again today. As I film this, the NBA game seven championship is happening tonight here in the US and the Knicks aren't in it. But back to the topic of this lecture. We have Jeremy Lin's points per game across 10 games. We can get summary statistics from this, Right? So we can get what was his average across this segment or this section of the season? So what was his average across these 10 games? And that's a common statistic in a lot of sports. So points per game or say goals per season, if you're looking at football internationally or hockey here in the US Is also big right now. So we could get just average points per game. But I also might want to know, and it's an important statistic to look at, if you're looking at sort of the quality of players is how variable are these players across a certain stretch of games? So was Jeremy Lin consistent across these 10 games, or was he sort of all over the place, having a good night one night, a bad night the next night? So first, let's calculate the mean. That's just the sum of all the scores divided by n. And I did that down at the bottom of the screen here. To get the mean, I just summed that column of points per game. The sum of that column is 227. We're averaging over 10 games. So it's 227 over 10 or 22.7. So during that 10 game stretch, Jeremy Lin is averaging 22.7 points per game. That's the mean. That's a measure of central tendency. But we want to know about his variability over those 10 games. So the way to calculate variability is variance and standard deviation. The first thing we want to do is for each game, we want to calculate what's known as a deviation score. And that's this column. These are deviation scores. So to get a deviation score, I just take how many points did Jeremy lin score in one game and compare it to his average. So in this first row, I can take 28 and subtract his average 22.7, and I get 5.3. So he was deviating from his average about 5.3. He was 5.3 above average that night. And so on. I can calculate each deviation score. The whole point of variability is getting sort of an average deviation. Now, I can't take the average of this column because it sums to zero. So if I sum that column, I would get zero and divide by 10, I'd have zero. So instead what we'll do is we'll square each deviation score. That's this last column is the deviation scores squared. That gets rid of sine. So then when I sum the squared deviation scores, I can divide by n and that gives me variance. So this last column, I've just taken each deviation score, squared it, and then sum all the squared deviation scores to get 922.1. If I divide by 10, that gives me 92.21. So to summarize those results, his average points per game or mean was 22.7. The variance standard deviation squared was that 92.21. It was the sum of squared deviations divided by n. For short, we're going to call that sum of squares divided by n. If we take the square root of that Then we get the standard deviation 9.6 by taking the square root. That brings us back to the units that we started in. Remember, we had to square everything to get rid of sine when we went from deviation scores to squared deviation scores. So this last step, we take the square root. That brings us back to the units we were in, which is points per game. What this is saying is on average he was fluctuating about 10 points per game. Is that really accurate? Not really. He wasn't really fluctuating about 10 points per game once he had the opportunity to start. Right. The standard deviation is 9.6. Because I included that one game where he only scored two points. He didn't start that game. If we don't include that, then his standard deviation will go down. Before I do that, I just want to point out some notation. Again. I'm going to use m for mean, SD for standard deviation, SD squared for variance. That's also known as mean squares for the mean sum of square or mean squared deviations. So mean squares, sums of squares. These are important definitions to know going forward.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







