Categorical Variable

advertisement
CHAPTER 1
Exploring Data
Introduction
Data Analysis:
Making Sense of Data
The Practice of Statistics, 5th Edition
Starnes, Tabor, Yates, Moore
Bedford Freeman Worth Publishers
CHAPTER 1
Exploring Data
1.1
Analyzing Categorical
Data
The Practice of Statistics, 5th Edition
Starnes, Tabor, Yates, Moore
Bedford Freeman Worth Publishers
Do now
1. What is the difference
between categorical
and quantitative?
2. Give an example of
data that is
quantitative and one
that is categorical.
The Practice of Statistics, 5th Edition
Starnes, Tabor, Yates, Moore
Bedford Freeman Worth Publishers
Data Analysis: Making Sense of Data
Learning Objectives
After this section, you should be able to:
 IDENTIFY the individuals and variables in a set of data
 CLASSIFY variables as categorical or quantitative
The Practice of Statistics, 5th Edition
4
Analyzing Categorical Data
Learning Objectives
After this section, you should be able to:
 DISPLAY categorical data with a bar graph
 IDENTIFY what makes some graphs of categorical data deceptive
 CALCULATE and DISPLAY the marginal distribution of a
categorical variable from a two-way table
 CALCULATE and DISPLAY the conditional distribution of a
categorical variable for a particular value of the other categorical
variable in a two-way table
 DESCRIBE the association between two categorical variables
The Practice of Statistics, 5th Edition
5
Data Analysis
Statistics is the science of data.
Data Analysis is the process of organizing, displaying, summarizing,
and asking questions about data.
Individuals
 objects described by a set of data
Variable
 any characteristic of an individual
Categorical Variable
 places an individual into
one of several groups or
categories.
The Practice of Statistics, 5th Edition
Quantitative Variable
 takes numerical values for
which it makes sense to find
an average.
6
Data Analysis
A variable generally takes on many different values.
• We are interested in how often a variable takes on each value.
Distribution
 tells us what values a variable takes and how often
it takes those values.
Variable of Interest:
MPG
The Practice of Statistics, 5th Edition
Dotplot of MPG
Distribution
7
How to Explore Data
Examine each variable
by itself.
Then study relationships
among the variables.
Start with a graph
or graphs
Add numerical
summaries
The Practice of Statistics, 5th Edition
8
From Data Analysis to Inference
Population
Sample
Make an Inference
about the
Population.
The Practice of Statistics, 5th Edition
Collect data from a
representative
Sample...
Perform Data
Analysis, keeping
probability in
mind…
9
Data Analysis: Making Sense of Data
Section Summary
In this section, we learned how to…
 A dataset contains information on individuals.
 For each individual, data give values for one or more variables.
 Variables can be categorical or quantitative.
 The distribution of a variable describes what values it takes and
how often it takes them.
 Inference is the process of making a conclusion about a
population based on a sample set of data.
The Practice of Statistics, 5th Edition
10
A class survey Here is a small part of the data set that describes the
students in an AP® Statistics class. The data come from anonymous
responses to a questionnaire filled out on the first day of class.
3.
The Practice of Statistics, 5th Edition
•(a) What individuals does this data set
describe?
•(b) What variables were measured?
Identify each as categorical or
quantitative.
• (c) Describe the individual in the
highlighted row.
11
Answers
(a) AP® Statistics students who completed
a questionnaire on the first day of class.
(b) Categorical: gender, handedness, and
favorite type of music. Quantitative:
height, homework time, and the total
value of coins in a student’s pocket.
(c) The individual is a female who is righthanded. She is 58 inches tall, spends
60 minutes on homework, prefers
Alternative music, and has 76 cents in
her pocket.
The Practice of Statistics, 5th Edition
12
Categorical Variables
Categorical variables place individuals into one of several groups or
categories.
Frequency Table
Format
Variable
Count of Stations
Format
Percent of Stations
Adult Contemporary
1556
Adult Contemporary
Adult Standards
1196
Adult Standards
8.6
Contemporary Hit
4.1
Contemporary Hit
569
11.2
Country
2066
Country
14.9
News/Talk
2179
News/Talk
15.7
Oldies
1060
Oldies
Religious
2014
Religious
Rock
869
Spanish Language
750
Other Formats
Values
Relative Frequency Table
Total
The Practice of Statistics, 5th Edition
1579
13838
7.7
14.6
Rock
6.3
Count
Spanish Language
Other Formats
Total
Percent
5.4
11.4
99.9
13
Displaying Categorical Data
Frequency tables can be difficult to read.
Sometimes is is easier to analyze a distribution by displaying it with a
bar graph or pie chart.
Relative Frequency
Table
Percent
of Stations
Frequency
Table
Count
of Stations
2500
2000
Format
1000
500
0
Format
Adult Contemporary
1556
Adult Contemporary
Adult Standards
1196
11%Standards 11%
Adult
Contemporary Hit
1500
Count of Stations
569
5%
Contemporary Hit
Country
2066
News/Talk
2179
News/Talk
Oldies
1060
Oldies
Religious
2014
6%
15%
Religious
869
Rock
Spanish Language
750
8%
Spanish Language
16%
Total
The Practice of Statistics, 5th Edition
1579
13838
11.2
Adult Standards
8.6
Contemporary hit
4.1
9%
Country
14.9
Country
Rock
Other Formats
Percent of Stations
Adult Contemporary
Other Formats
Total
4%
News/Talk
15.7
Oldies 7.7
15%
14.6
Religious
Rock
6.3
5.4
Spanish
11.4
Other
99.9
14
Graphs: Good and Bad
Bar graphs compare several quantities by comparing the heights of
bars that represent those quantities. Our eyes, however, react to the
area of the bars as well as to their height.
When you draw a bar graph, make the bars equally wide.
It is tempting to replace the bars with pictures for greater eye appeal.
Don’t do it!
There are two important lessons to keep in mind:
(1) beware the pictograph, and
(2) watch those scales.
The Practice of Statistics, 5th Edition
15
Two-Way Tables and Marginal Distributions
When a dataset involves two categorical variables, we begin by
examining the counts or percents in various categories for one of the
variables.
A two-way table describes two categorical variables,
organizing counts according to a row variable and a
column variable.
Young adults by gender and chance of getting rich
Female
Male
Total
Almost no chance
96
98
194
Some chance, but probably not
426
286
712
A 50-50 chance
696
720
1416
A good chance
663
758
1421
Almost certain
486
597
1083
Total
2367
2459
4826
The Practice of Statistics, 5th Edition
What are the variables
described by this
two-way table?
How many young
adults were surveyed?
16
Two-Way Tables and Marginal Distributions
The marginal distribution of one of the categorical variables in a twoway table of counts is the distribution of values of that variable among
all individuals described by the table.
Note: Percents are often more informative than counts, especially
when comparing groups of different sizes.
How to examine a marginal distribution:
1)Use the data in the table to calculate the marginal
distribution (in percents) of the row or column totals.
2)Make a graph to display the marginal distribution.
The Practice of Statistics, 5th Edition
17
Two-Way Tables and Marginal Distributions
Examine the marginal
distribution of chance
of getting rich.
Young adults by gender and chance of getting rich
Female
Male
Total
Almost no chance
96
98
194
Some chance, but probably not
426
286
712
A 50-50 chance
696
720
1416
A good chance
663
758
1421
Almost certain
486
597
1083
Total
2367
2459
4826
Chance of being wealthy by age 30
Percent
Almost no
chance
194/4826 = 4.0%
Some chance
712/4826 = 14.8%
A 50-50 chance
1416/4826 = 29.3%
A good chance
1421/4826 = 29.4%
35
30
25
Percent
Response
20
15
10
5
0
Almost certain
1083/4826 = 22.4%
Almost
none
Some
chance
50-50
chance
Good
chance
Almost
certain
Survey Response
The Practice of Statistics, 5th Edition
18
Relationships Between Categorical Variables
A conditional distribution of a variable describes the values of that
variable among individuals who have a specific value of another
variable.
How to examine or compare conditional distributions:
1) Select the row(s) or column(s) of interest.
2) Use the data in the table to calculate the conditional
distribution (in percents) of the row(s) or column(s).
3) Make a graph to display the conditional distribution.
• Use a side-by-side bar graph or segmented bar
graph to compare distributions.
The Practice of Statistics, 5th Edition
19
Relationships Between Categorical Variables
Calculate the conditional
distribution of opinion
among males. Examine the
relationship between gender
and opinion.
Young adults by gender and chance of getting rich
Female
Male
Total
Almost no chance
96
98
194
Some chance, but probably not
426
286
712
A 50-50 chance
696
720
1416
A good chance
663
758
1421
Almost certain
486
597
1083
2367
2459
4826
Total
Response
Male
Female
Almost no chance
98/2459 =
4.0%
96/2367 =
4.1%
286/2459 =
11.6%
426/2367 =
18.0%
720/2459 =
29.3%
696/2367 =
29.4%
758/2459 =
30.8%
663/2367 =
28.0%
597/2459 =
24.3%
486/2367 =
20.5%
A 50-50 chance
A good chance
Almost certain
100%
90%
80%
70%
Percent
Some chance
Chance of being wealthy by age 30
Almost certain
60%
50%
Good chance
40%
30%
50-50 chance
20%
10%
Some chance
0%
Males
Opinion
The Practice of Statistics, 5th Edition
Females
Almost no
chance
20
Relationships Between Categorical Variables
Can we say there is an
association between gender and
opinion in the population of
young adults?
Making this determination
requires formal inference, which
will have to wait a few chapters.
Caution!
Even a strong association between two categorical variables can
be influenced by other variables lurking in the background.
The Practice of Statistics, 5th Edition
21
Data Analysis: Making Sense of Data
Section Summary
In this section, we learned how to…
 DISPLAY categorical data with a bar graph
 IDENTIFY what makes some graphs of categorical data
deceptive
 CALCULATE and DISPLAY the marginal distribution of a
categorical variable from a two-way table
 CALCULATE and DISPLAY the conditional distribution of a
categorical variable for a particular value of the other categorical
variable in a two-way table
 DESCRIBE the association between two categorical variables
The Practice of Statistics, 5th Edition
22
Homework
Page 20 – 24 # 9, 13, 14,
17-23, 25, 26
The Practice of Statistics, 5th Edition
Starnes, Tabor, Yates, Moore
Bedford Freeman Worth Publishers
Download