Density Curves | Modeling data distributions | AP Statistics | Khan Academy
What we're going to do in this video is think about how to visualize distributions of data, then to analyze those visualizations, and we will eventually get to something known as a density curve. But let's start with a simple example just to review some concepts.
Let's say I go to 16 students and I ask them to measure how many glasses of water they drink per day for the last 30 days and then to average it. And so this data point right over here tells us one student drank an average of 0.5 glasses of water per day. That person is probably very dehydrated. This person drank 8.1 glasses of water per day on average for the last 30 days; they are better hydrated.
If we want to visualize that, we can set up a frequency histogram where we can create some categories. So this first category would be for data points that are greater than or equal to zero and less than one, and we can see that two data points fall into that category. And that's why the bar right over here for that category is up to two. This category right over here is greater than or equal to three and less than four. Notice there are four data points in that category, and on this frequency histogram, the height of the bar is indeed four.
So this is a nice way of looking at a distribution, but you might be more concerned with what percentage of my data falls into each of these categories. That becomes especially interesting if we have many, many, many, many data points. And if we had, you know, 1 billion, 600 mil, 432,500 townhouse. But in that first category, instead of the bar height being two, the bar height is now 12.5%. Why is that? Because two of the 16 data points fall into this category. 2 of 16 is 1/8, which is 12.5%. In this one right over here, notice instead of the height being 4 for four data points, it's now 25%. But these are saying the same thing; four out of the 16 data points fall into this category. 4 of 16 is 1/4, which is 25%.
So both of these types of histograms are really useful, and you will see them used all of the time. But there are also cases where you have many, many, many more data points, and you want more granular categories. So what you could do is, well, let's just make our categories a little more granular. For example, instead of them being one glass of water wide, maybe you make them half a glass of water wide. So this first category could be greater than or equal to zero and less than 0.5, and that will give you a clearer picture.
I'm now assuming in a world where we have more than 16 data points; maybe we have 16 million data points. This would be percentages on the left-hand side, but maybe that isn't good enough for you. Maybe you want to get even more granular, so you make each category a quarter of a glass. But maybe that doesn't satisfy you; you want to get more and more and more granular. Well, you could imagine where this is going. You could get to a point where you're approaching an infinite number of categories, and each category is infinitely thin — super, super thin to the point that if you just connect the tops of the bars, you will actually get a curve.
And this type of curve is something that we actually use in statistics. And as promised at the beginning of the video, this is the density curve we talk about. What's valuable about a density curve is it is a visualization of a distribution where the data points can take on any value in a continuum; they're not just thrown into these coarse buckets.
So how would you interpret something like this? If you look over the entire interval from zero, let's say to nine — assuming no one drank more than an average of nine glasses per day, even in our 16 million data points — well then the area under the curve over that interval is going to be 100% or 1.0. This is going to be true for any density curve; the entire area of the curve is 100%! It represents all of the data points. A density curve will also never take on a negative value; you won't see the curve dip down and do something strange like that.
Now, with that out of the way, let's think about how we would make use of it. If I wanted to know what percentage of my data falls between two and four glasses, well I would look at that interval. I'd go from 2 to 4; I would look at this interval right over here, and I would try to figure out the area under the curve here. This area is going to be greater than or equal to zero and less than or equal to 100%. When I eyeball it right over here, it looks like it's about 40% of the entire area under the curve. So just eyeballing it, I would say roughly 40% of my data falls into this interval.
If I were to ask you what percentage of the data is greater than three, well then you would be looking at this area, and it looks like it is about 50%. But once again, I am estimating it. But you can start to see how even with estimation, a density curve could be useful in the real world. Statisticians will often have tables that might represent the information for the density curve; they might have computer programs or some type of automated tool. And there are also well-known density curves — the famous bell curve that we will study later on — where there's a lot of precise data and a lot of tools to exactly figure out the areas.
The last thing I'd like to cover is a key misconception for density curves. If I were to ask you approximately what percentage of my data is exactly three glasses of water per day, and when I say exactly, I mean exactly the number 3.00, with zeros going on and on forever — the exact number three — well, you might be tempted to just say, "Okay, this is three. Let me see the corresponding point on the curve." It looks like it is about 0.2 or a little higher than that, so maybe you would say a little bit more than 20% or approximately 20%. And what I would say to you is this is wrong.
Remember, the percentage of the data in an interval is not the height of the curve; it is the area under the curve in that interval. And if we're just talking about one precise value, like exactly the number three, there is no area under the curve. This vertical line that I just drew over the number of three has no width, and this actually makes sense in the real world. Even if you were to look at 16 million people, it is very unlikely that anyone would drink exactly three glasses of water per day. I'm talking about not one out of more or one atom less than three glasses. There might be many people between 2.9 and 3.1, but no one is exactly three glasses a day.
When someone says, "I'm drinking three glasses of water per day," that'd be a rough estimate. They're probably 3.1, or 2.99999... or 3.15 or whatever else. And so, instead, you could say what percentage falls into an interval — maybe that is greater than or equal to 2.9 and less than or equal to 3.1. And so, once you have an interval, then you actually can look at the area. So we're going to go from 2.9 to 3.1.
So now we have an interval that actually has width, and so it would be roughly the size of this yellow area that I'm shading in right over here. And we can approximate it with a rectangle even though the top of this curve isn't flat. But we could say, "Look, it's approximately like a rectangle that is 0.2 high." And what's the width? The width here, if we're going from 2.9 to 3.1, the width is going to be 0.2 wide. And so we could approximate this area by approximating this rectangle.
The area of the rectangle — 0.2 * 0.2 — that would give us an area of 0.04, or we could say approximately 4% of the data falls in this interval.