The three rules of data analysis are: • Make a picture – it will help you to think clearly about the patterns and relationships that may be hiding in your data • Make a picture – it will show the important features and patterns in your data • Make a picture – it will tell others about your data
A frequency table lists the categories in a categorical variable and gives the count of observations for each category.
A relative frequency table lists the categories in a categorical variable and gives the percentage of observations for each category.
A bar chart displays the distribution of a categorical variable, showing the counts for each category next to each other for easy comparison. Bar charts should have spaces between each bar. The bars could be arranged in any order. When making any type of graph, you should always give it a title and label the vertical and horizontal axis
One thing that you must be able to do in AP Statistics is to describe a graph. You should write conclusions that are clear, concise, complete, and in context. The four C’s. Let’s write a sentence or two describing the previous graph. The number of crew members aboard the Titanic was more than any of the 3 classes of passengers. The number of second class passengers was the least of all of the classes.
Another display for the distribution of categorical data is a pie chart. A pie chart slices a circle into pieces whose size is proportional to the fraction of the whole in each category. To construct a pie chart, take the relative frequency of each category and multiply it by 360° to get the degree amount of each slice
To summarize, before you make a bar chart or pie chart, always check the Categorical Data Condition : The data are counts or percentages of individuals in categories. If you want to make a relative frequency bar chart or pie chart, make sure that the categories don’t overlap, so no individual is counted twice. If the categories do overlap, you can still make a bar chart, but the percentages won’t add up to 100%.
Contingency Tables • A contingency table allows us to look at two categorical variables together. • It shows how individuals are distributed along each variable, contingent on the value of the other variable. • Example: we can examine the class of ticket and whether a person survived the Titanic:
Contingency Tables (cont.) • The margins of the table, both on the right and on the bottom, give totals and the frequency distributions for each of the variables. • Each frequency distribution is called a marginal distribution of its respective variable. • The marginal distribution of Survival is: 711/2201=32.3% 1490/2201=67.7%
Contingency Tables (cont.) • Each cell of the table gives the count for a combination of values of the two values. • For example, the second cell in the crew column tells us that 673 crew members died when the Titanic sunk.
Conditional Distributions • A conditional distribution shows the distribution of one variable for just the individuals who satisfy some condition on another variable. • The following is the conditional distribution of ticket Class, conditional on having survived:
Conditional Distributions (cont.) • The following is the conditional distribution of ticket Class, conditional on having perished:
Conditional Distributions (cont.) • The conditional distributions tell us that there is a difference in class for those who survived and those who perished. • This is better shown with pie charts of the two distributions:
Conditional Distributions (cont.) • We see that the distribution of Class for the survivors is different from that of the nonsurvivors. • This leads us to believe that Class and Survival are associated, that they are not independent. • The variables would be considered independent when the distribution of one variable in a contingency table is the same for all categories of the other variable.
EYE COLOR What percent of females are brown eyed? 16/32 = .5 or 50% What percent of brown eyed students are female? 16/36 = .4444 or 44.4% What percent of students are brown eyed females? 16/64 = .25 or 25 %
EYE COLOR What’s the distribution of eye color? blue eyes are 10/64 = 15.625%, brown eyes are 36/64 = 56.25% and green/hazel/other eyes are 18/64 = 28.125% What’s the conditional distribution of eye color for males? Blue are 6/32 = 18.75%, brown are 20/32 = 62.5%, green/hazel/other are 6/32 = 18.75% Compare the percent who are female among the blue eyed students to the percent of all students who are female. 4/10 = 40% of the blue eyed students are female and 32/64 = 50% of all students are female Does it seem that eye color and sex are independent? Explain
Eye color The conditional distributions tell us that there is a difference in eye color for males and females. It seems that eye color and sex are not independent.
What Can Go Wrong? • Don’t violate the area principle. • While some people might like the pie chart on the left better, it is harder to compare fractions of the whole, which a well-done pie chart does.
What Can Go Wrong? (cont.) • Keep it honest—make sure your display shows what it says it shows. • This plot of the percentage of high-school students who engage in specified dangerous behaviors has a problem. Can you see it?
What Can Go Wrong? (cont.) • Don’t confuse similar-sounding percentages—pay particular attention to the wording of the context. • Don’t forget to look at the variables separately too—examine the marginal distributions, since it is important to know how many cases are in each category.
What Can Go Wrong? (cont.) • Be sure to use enough individuals! • Do not make a report like “We found that 66.67 of the rats improved their performance with training. The other rat died.”
What Can Go Wrong? (cont.) • Don’t overstate your case—don’t claim something you can’t. • Don’t use unfair or silly averages—this could lead to Simpson’s Paradox, so be careful when you average one variable across different levels of a second variable.
SIMPSON’S PARADOX EXAMPLE It’s the last inning of an important game. Your team is one run behind with the bases loaded and two outs. The pitcher is due up, so you’ll be sending in a pinch-hitter. There are 2 batters available on the bench. Whom should you send in to bat player A or player B?
What have we learned? • We can summarize categorical data by counting the number of cases in each category (expressing these as counts or percents). • We can display the distribution in a bar chart or pie chart. • And, we can examine two-way tables called contingency tables, examining marginal and/or conditional distributions of the variables.