If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Analyzing trends in categorical data

Sal solves an example where he is asked to calculate relative frequencies and analyze trends in categorical data.  Created by Sal Khan.

Video transcript

Voiceover:The relative frequency table below shows statistics from a study about the relationship between the amount of time a person spends using a computer before bed and the amount that a person sleeps each night. For computer use, each participant was classified as minimal, moderate, or extreme. Let's look at the frequency table below. Let's see. That's the frequency table, and let's see, there's 3 categories of computer time, just like they told us, minimal, moderate, and extreme. This is before they go to bed or at night. Then they have the 3 categories of how much they're sleeping, 5 or a few hours per night, 5 to 7 hours per night, or 7 or more hours. OK, so that's fair enough. Let's see what they want us to do. They tell us, "Suppose there were 17 people in the study "who are both in moderate computer users "and got 5 to 7 hours of sleep." Moderate, 5 to 7. This category right over here, there are 17 people in this category over here. Just to mark that, let me ... I copy and pasted this chart onto my scratch pad so I can write on it. This group, they're telling us this group, and my pen is really acting up. I don't understand what's going on. This group right over here, there are 17 people. That group right over there is 17 people. Now what are they asking us? They're saying, "How many people in the study "were both extreme computer users "and got 5 to 7 hours of sleep? "Round to the nearest whole number." So extreme and got 5 to 7. I'll get my scratch pad out. They are saying how many people are in this bucket, in this bucket right over here? I think I have to replace my pen tablet or something. I don't know why it's getting all splotchy like this. How would we think about this? There are 17 people in this group. How many people are in this group? They tell us that 17 is 34% of the row, of the row total, so I guess you could say 17 is 34.3% of the moderate computer users, or you could say that 17 is 30% of the people who slept 5 to 7 hours each night, or you could say 17 is 10%, is 10% of the total number of people. Let's just go with that. We could figure out the total number of people. So 10%, actually, let me write it this way. So 10% of the total, 10% of total is going to be equal to 17, or that the total, just divide both sides by 10% is equal to 17 divided by 10%, which is the same thing as 17 over 0.1, which, of course, is equal to 170. The total is 170, and they tell us that extreme, extreme computer users represent ... extreme computer users who sleep 5 to 7 hours per night represent 11.7%, 11.7% of the total. So the answer to their question of how many people were extreme computer users who sleep 5 to 7 hours per night, it's 11.7% of 170. Let's go back over here. We actually have a little calculator tool here. It's 11.7%, which is 0.117, times 170, times 170 is, and let me make sure that you can see what I'm doing by scrolling over a little bit, times 170 is equal to 19.89. If we're rounding to the nearest whole, that's going to be 20 people, 20 people. And then they are going to ask us some questions. They say, "Does the table show evidence "of an association between being a minimal computer user "and getting 7 hours of sleep or more?" Let's just look at the chart. An association between being a minimal computer user and getting 7 hours of sleep or more. It looks like minimal computer users, these are the minimal computer users who get 7 or more hours of sleep. There's a couple of ways to read this. You could say that 51% of minimal computer users get 7 or more hours of sleep. You could say that of the people who get 7 or more hours of sleep, 55% are minimal computer users. And of course, this one just says that minimal computer users who get 7 or more hours of sleep represent 18.3% of all of the people who were surveyed. Let's look at the choices. Actually, before I even look at the choices, let's see if there is an association. It does look like if you look at, if you look at minimal computer users, it looks like a small percentage, only 16% get 5 or few hours. A higher percentage gets 5 to 7 hours, and 51%, the highest percentage, gets 7 or more. So it looks like for minimal computer users, it looks like the distribution is definitely weighted towards getting more sleep. For example, if we look at the extreme computer users, it's the opposite trend. It's 47% have 5 or few hours per night, 33% 5 to 7 hours, and then only 19% get 7 or more. It looks like the moderate is someplace in between. Just looking at this, just looking at each of these rows, it looks like there is a trend where if you use a computer for less time, you are more likely to have more sleep, and likewise, if you use a computer more, you're more likely to have less sleep. Another way to think about it, when you look at the people who are getting 7 or more hours of sleep, a majority of them, a majority of them are minimal computer users, and there's 3 categories. So for 55% to be minimal computer users really does feel like the minimal computer users are more ... they're definitely more disproportionately representing the people who are getting 7 ... or disproportionally represented in this category of 7 or more hours of sleep. You see that the extreme computer users in this category, they represent only 20% of this category. So it does look like there is an association between minimal computer use and getting 7 or more hours of sleep. But let's look at the actual choices they give us. Does the table show evidence of association between a minimal computer user and getting 7 hours of sleep or more? Yes, because 35.1% are extreme computer users, and 29.1% of people are moderate. I go with the yes, but this doesn't seem to really back up the claim. This is just giving us some random data about the percentage that are extreme computer users or moderate computer users. No ... well ... I explained why I go with yes, that there does seem to be a trend, and I don't even believe what this statement is because the total column percentages are essentially equal. We see that the total column ... that the column percentages, the column percentages are not equal for the various, for people who are getting 7 hours or more of sleep. We see that right over here, 55, 25, 20, so I won't go with that one either. Yes, because 51% of minimal computer users get 7 or more hours of sleep, and only 33% of all computer users get 7 or more hours. Yeah. I mean that seems pretty good. 51% of minimal computer users get 7 or more hours of sleep, and only 33% of all computer users get 7 or more hours of sleep. That looks like a pretty good explanation, so I'll check that, but let's just review all of them. No. Well, I already said I think it's yes, but because the total percentage of extreme users who get 5 to 7 hours of sleep is the same as the total percentage of moderate computer users who get 5 to 7 hours of sleep. So that doesn't really meet, it's not touching on the point that we're looking for. Yes, because 55% of people who get 75 ... who get 7 or more hours are minimal computer users, and only 35% of all people are minimal computer users. Actually, I'll go with this as well. Oh yeah, this is a multi-select here, so I could select that one as well. This one, we're looking at of the ... so here, we looked at the percentage of minimal computer users who get 7 hours of sleep, and we saw that percentage is higher than for the whole population. Here, we're looking at the people who get 7 or more hours of sleep, and we're saying 55% of them, 55% of them are minimal computer users even though only 35% of all the people are minimal computer users. So I would go with both of these. And so let us check our answer, and we got it right.