0% found this document useful (0 votes)
12 views24 pages

4 Chap2 TwoVars

The document discusses the description of relationships between two variables, focusing on cases with two quantitative variables. It highlights the use of scatterplots for visualization and mentions correlation and regression models for statistical analysis of associations. The document emphasizes the importance of understanding whether variables are associated or independent.

Uploaded by

sunvssky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views24 pages

4 Chap2 TwoVars

The document discusses the description of relationships between two variables, focusing on cases with two quantitative variables. It highlights the use of scatterplots for visualization and mentions correlation and regression models for statistical analysis of associations. The document emphasizes the importance of understanding whether variables are associated or independent.

Uploaded by

sunvssky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

ECO1005 I NTRODUCTION TO E CONOMIC S TATISTICS

C HAPTER 2.1.1, 2.2.4, 2.2.6, 2.3.3


D ESCRIBING TWO VARIABLES JOINTLY

노승화
S EPTEMBER 10, 2024
D ESCRIBING TWO VARIABLES AND ASSOCIATION

• So far we have been focusing on how a single variable can


be described.
• We would be also interested in describing the relationship
between variables.
✓ The two variables can be associated.
✓ The two variables can be independent if there is no
association present.

1 / 17
C ASE 1: T WO QUANTITATIVE VARIABLES
• Scatterplots are useful for visualizing the relationship
between two numerical variables.
• Using correlation and regression model you would be able
to analyze association through statistical analysis (later).
• Is there association?

● ● ● ●

● ●● ●



● ●
50

50
● ●
● ●
● ●
● ●
● ● ● ● ●
● ● ● ● ●
●● ● ● ● ● ●
●● ● ● ● ● ●
● ● ●● ●
● ● ● ●
● ● ● ● ●

● ● ● ●●● ● ● ● ● ● ● ●
● ● ● ● ●
● ●

● ●● ●● ● ●● ● ●●● ● ●
40

40

● ● ● ● ● ● ● ● ●● ●
●●
● ●● ●● ● ● ● ● ●

● ●● ●● ● ●
●● ● ● ●●●● ● ●● ● ●
● ●
● ●
● ●
● ● ●● ●
● ●● ●● ● ● ● ●
● ●● ● ●
● ●● ●● ●● ● ● ● ●●● ●
● ●
●●
●● ●● ●● ● ●●●
● ● ●●● ●●●●● ●● ●●● ● ● ● ●● ● ●
● ●●
● ●●
● ●● ●● ●
●● ●●
● ●

● ●
● ● ●● ● ●● ● ● ● ● ●●
● ●● ●● ●● ●● ● ● ●
● ● ● ● ●● ● ●●
● ●● ● ● ●●●●●●● ● ●●●●●●
● ● ● ● ● ●
● ● ● ● ● ●

●●
● ● ●
● ●● ●●● ●● ●● ● ●●● ●
●●● ● ●
● ● ● ● ●

●● ●● ● ●●
BMI

BMI
●● ● ●●
● ● ● ●● ● ●●
●● ●● ● ●● ●●●●● ● ●●●● ●● ●● ●●●● ● ●● ●
● ● ●

●●




●●● ●●
● ● ● ●●

● ●
● ● ●


●● ● ● ●● ● ●
● ●●● ●● ●
● ● ●● ●● ●● ● ●● ●● ●
●●● ●● ●● ●●●●●● ●●●
●●●● ●●●

● ●●● ● ●
●●● ● ● ● ●
● ● ● ●
●● ●●●●●●●●●● ●●●● ●●●●●● ●● ●●● ● ● ● ● ●
● ●
● ● ● ●
● ●●● ●
● ●
●●

●●●

●● ● ●● ● ● ●
● ● ●● ● ●●● ●● ● ●●
● ● ●



● ● ●
●●● ●
● ● ● ● ●●● ●
● ●●● ●●●
●●
●● ●●● ●●●● ●●
● ●●●●●
● ●●● ●●
●● ●


● ●●



● ●●●●● ● ● ●● ●
●●
● ●
● ●●
● ● ●●

● ● ●
● ●●
● ● ● ●●
● ● ●
● ● ●●
●●● ●●● ● ●●●● ●● ● ● ● ● ● ● ● ● ● ● ●
30

30
●● ● ●
● ●●●●●●● ●
●●●
●●●●
●● ●●
●●●● ●●●
● ●
●● ●●
●●●
●●
●●

● ● ●● ● ● ●● ●●● ● ●●

● ● ●



● ●
● ●
●●
● ● ● ●
●● ●

●●● ●● ● ● ●
●●● ●● ●●● ● ●● ●●●●
● ●●●●●●●●
● ●●●●●
● ●● ●●● ● ● ●
●●● ● ●●● ●●
● ● ● ● ●
●● ● ●
●●
●●●●●
●● ●●● ●●●●●●● ●●● ●
●●●●●●●●●● ●●● ● ●
● ●
● ●
●●

● ●
● ●● ●
●●● ● ● ●●
● ●
● ● ●
●●● ●
● ●● ●●
●●●●● ●●
●● ●●

●●●● ●● ● ●
● ● ●
●●● ●
● ●
● ● ●●
● ● ●
●●
● ● ●
●●● ●
●●● ●●● ● ● ●
● ●●● ●●●● ●● ●●
●●●
●●
●●●● ●●●
●●●
●●●● ●●●●● ●●●
● ● ●


●●

● ●
● ●
●●

● ●
● ●
● ● ● ● ● ● ● ●
●●
●●●
●●
● ●●●
● ●●
● ●●●
●● ●●●●
●●● ●●●
●●● ●●●●
●●● ●● ●
● ●●●● ● ●
● ●

● ●
●●
● ●
● ●
● ●
● ●
●●● ●●
● ●
● ● ●●
● ●

● ●● ●●
● ● ●
●● ●
●●●●
●●●
● ●

●●●●●●●● ●●●
● ●●
● ●● ●●●●● ●
●●●●● ●●●● ●● ● ●
●●

●●
● ● ●
● ● ●
● ●
●●● ●
●●

● ● ●
● ●●
● ● ● ●
● ●●
● ●●
● ●●● ● ●● ●
●●● ●● ●
●●

●●●

●● ● ● ● ●
● ●
● ●
● ●
● ● ● ●
● ●
●●● ● ● ●● ● ●
● ● ●●●● ●●
●●●● ●

● ●●

●●●●
●●


●● ●●●

●●


●●●●●

●●
●●●
●●
●●●
●●
●●
●●●

●●●●
● ● ●● ● ● ● ●
● ●

●●
● ●●


●●
● ●
● ●
● ●
● ● ●

●●

● ●
● ● ●●
● ● ● ●●

● ●●● ●
●●●● ●●
● ●●
●●●


● ●
●●● ●●●
●●●●●
● ●
●● ●●●●
●●●● ●
●● ●●●●●● ●
●● ●

● ●
● ●



● ●●

● ● ●
● ●
●●

● ●●
● ● ●
● ●
● ●
●●

● ●●
● ●
●●●●●●●●●●
●●●
● ●


●●


●●


● ●
●●●
●●● ●

●●
●●
●●
●●●
●●
●●●
● ●
●●●
● ●●
● ●● ●●●●●● ●●● ●



● ●
● ●
● ●
● ●●● ●
● ● ●●
● ● ●●

● ● ●

● ●
●●● ● ●●●
● ●●
● ●● ●
●●
● ●
●●●●●
●●●
●● ●
●● ●
●● ●
●●
● ●
● ●●
●● ●
●●
●●
● ●
●●●●●●● ● ●●
● ● ●●
● ● ●
● ●
●●
● ● ●
● ●
● ● ● ● ● ●
●●
● ● ● ●

●●● ●

● ●●
●●●●
●●●
● ●
● ●
●● ●●
● ●






●●


●●
●●●
●●●
●●
●●●
●●
●●


●●
●● ●●
●●● ● ●● ● ●




● ●




● ●
● ●
● ● ●
● ●●

● ●●

● ● ●
●●
●● ● ●
● ● ●
●● ●
●●
●● ●●
●●
● ●●
● ●
●●●
●●●
●●
●●
●●●●
●●●
● ●●●

●●
● ●
●●●●● ●●●●●
● ● ●●● ●
● ● ●
● ●
● ● ●●
● ●
● ●
● ●●
● ● ● ●
● ●
● ● ●
● ●
●●
● ●
●●●
● ● ●
●●●●●
●●●●●●
● ●
●●●●
●●
●● ●

●●

●●●
●●
●●●
● ●●●
●●●
●●●
●●●●●●●●

●●

●● ●●
●● ● ●●
● ●


●●●
● ●
●●
● ●
● ●
● ●
● ●●● ●
●●● ●
●●
● ● ●●
● ● ●
● ● ● ●
●●● ●
● ●● ●●
●● ● ●●●
●●
●●●
●●●
● ●
●●
●●
● ●●
●●



●●
●●

●●
● ●
●●●
●●●
●●
● ●●
●●
●●●
● ●●●●●● ●● ●●

● ●

● ●●



● ●
● ●
● ● ●
● ●
●●●
● ●
● ● ● ●
●●●

● ●
● ● ●
● ●
●●

●●●
● ●



●●●
● ●

●●
●●
●●
●●●



●●
●●●

●●
●●



●●●
●●





●●●
●●



●●
●●
●●


●●●

●●
●●
●●●●●
● ●
●●●




●●





● ●

● ●


●●

●●




● ●
● ● ●
● ●●

● ● ●

●● ●● ● ●
●●
● ●
● ●
● ●
●●● ●● ●●●
● ●
● ●
●●● ●●● ●
●●●●●
●● ●●●●● ●
●●● ● ● ● ● ●
●● ●
● ● ●● ● ● ●●
● ● ● ●
20

20

●●
●●
●●●

●●●●
● ●
●●
●●●
● ●●
●●
●●●
●●
●●
●●●
●●●
●●
●●

●●

●●
●●
●●●
●● ●●
● ●
●● ●●●● ●
●●●
● ●

● ●
● ● ●
● ● ● ●
● ● ● ●●● ●
●●● ●
● ●
● ● ●
● ●●
● ●

●●●●●●●
●●●●●●● ●
● ●
●●●
● ●
●●●●●
●●● ●

●●

● ●

●●●●●●●
● ●●● ● ●● ● ● ●●
● ●
● ●

● ●
● ●
● ●
●●● ●
● ●
● ● ●
● ● ●●
● ● ●
● ●
●●●●●●

●●



●●●




●●●
●●●







●●●




●●
●●







●●●
●●
●●
●●●






●●









●●



●●●●●● ●


●●
● ●●

● ●

● ●●







● ●●

● ●
● ● ●



●●





●●

● ● ●

●● ●


●●
● ●


●●



●●
● ●
● ●● ●●●



●●





●●●





●●●







●●




●●●

●●
●●


●●
●●

●●




●●



●●


●●

●●●
●●



●●●●●●
● ●● ●● ● ● ●
● ●
●●


● ●






● ●
● ●
●●●




●●● ●
● ● ●

● ● ● ●
● ●●●
● ●
●●● ●
● ●● ●


●●


●●
● ●




●●
●●
●●
●●






●●●●





●●
●●●



●●
●●
●●●



●●
●●●●●
●●

●●●
●●
●● ●
●●
● ● ●●

● ●
● ●
● ●
● ●●●

●●
● ●

● ●
●● ●● ●
●● ●●
●●● ●
●●

● ●
● ● ●


●●
● ●●

●●
●●
●●●



●●
●●●


●●
● ●●

●●



●●●
●●

●●
● ●

●●●● ●
● ●●● ●

●●●

● ●
● ●





● ●
●●
● ● ●
●●●


●●
● ● ●
●●●
● ●


● ●● ● ●
● ● ●●
●● ●● ●● ●●●● ● ● ● ● ●
● ●●
● ●
●●● ●
●●●●
●●

●●



●●●




●●●
●●●
●●
●●

● ●●●●● ●● ●●●
● ●●●
● ●
● ●
● ●
● ●
● ● ●
● ● ●

●●
● ● ● ●● ● ●


●● ● ●

●●
●●
●●●●
● ●●
●●


● ●
●●●●
● ●● ●
●●●
● ● ●●
● ● ● ●●
● ● ●●
● ●● ●● ●
●●
●●●●●●● ●●●
● ●●
●●● ●● ● ●
● ●●
● ●

●●
●● ●● ●● ●
● ●
●●●●●●●
● ●●●●●● ●●● ●● ● ●

●●
● ● ● ● ●
●●●●●●●
●●●●
●● ● ●●

● ● ●
●●● ●
● ● ●● ●
● ●
● ●

● ●●● ●●
● ●

40 60 80 100 140 1.4 1.6 1.8 2.0


Weight (kg) Height (m)

2 / 17
C ASE 1: T WO QUANTITATIVE VARIABLES
• Scatterplots are useful for visualizing the relationship
between two numerical variables.
• Using correlation and regression model you would be able
to analyze association through statistical analysis (later).
• Is there association?

● ● ● ●

● ●● ●



● ●
50

50
● ●
● ●
● ●
● ●
● ● ● ● ●
● ● ● ● ●
●● ● ● ● ● ●
●● ● ● ● ● ●
● ● ●● ●
● ● ● ●
● ● ● ● ●

● ● ● ●●● ● ● ● ● ● ● ●
● ● ● ● ●
● ●

● ●● ●● ● ●● ● ●●● ● ●
40

40

● ● ● ● ● ● ● ● ●● ●
●●
● ●● ●● ● ● ● ● ●

● ●● ●● ● ●
●● ● ● ●●●● ● ●● ● ●
● ●
● ●
● ●
● ● ●● ●
● ●● ●● ● ● ● ●
● ●● ● ●
● ●● ●● ●● ● ● ● ●●● ●
● ●
●●
●● ●● ●● ● ●●●
● ● ●●● ●●●●● ●● ●●● ● ● ● ●● ● ●
● ●●
● ●●
● ●● ●● ●
●● ●●
● ●

● ●
● ● ●● ● ●● ● ● ● ● ●●
● ●● ●● ●● ●● ● ● ●
● ● ● ● ●● ● ●●
● ●● ● ● ●●●●●●● ● ●●●●●●
● ● ● ● ● ●
● ● ● ● ● ●

●●
● ● ●
● ●● ●●● ●● ●● ● ●●● ●
●●● ● ●
● ● ● ● ●

●● ●● ● ●●
BMI

BMI
●● ● ●●
● ● ● ●● ● ●●
●● ●● ● ●● ●●●●● ● ●●●● ●● ●● ●●●● ● ●● ●
● ● ●

●●




●●● ●●
● ● ● ●●

● ●
● ● ●


●● ● ● ●● ● ●
● ●●● ●● ●
● ● ●● ●● ●● ● ●● ●● ●
●●● ●● ●● ●●●●●● ●●●
●●●● ●●●

● ●●● ● ●
●●● ● ● ● ●
● ● ● ●
●● ●●●●●●●●●● ●●●● ●●●●●● ●● ●●● ● ● ● ● ●
● ●
● ● ● ●
● ●●● ●
● ●
●●

●●●

●● ● ●● ● ● ●
● ● ●● ● ●●● ●● ● ●●
● ● ●



● ● ●
●●● ●
● ● ● ● ●●● ●
● ●●● ●●●
●●
●● ●●● ●●●● ●●
● ●●●●●
● ●●● ●●
●● ●


● ●●



● ●●●●● ● ● ●● ●
●●
● ●
● ●●
● ● ●●

● ● ●
● ●●
● ● ● ●●
● ● ●
● ● ●●
●●● ●●● ● ●●●● ●● ● ● ● ● ● ● ● ● ● ● ●
30

30
●● ● ●
● ●●●●●●● ●
●●●
●●●●
●● ●●
●●●● ●●●
● ●
●● ●●
●●●
●●
●●

● ● ●● ● ● ●● ●●● ● ●●

● ● ●



● ●
● ●
●●
● ● ● ●
●● ●

●●● ●● ● ● ●
●●● ●● ●●● ● ●● ●●●●
● ●●●●●●●●
● ●●●●●
● ●● ●●● ● ● ●
●●● ● ●●● ●●
● ● ● ● ●
●● ● ●
●●
●●●●●
●● ●●● ●●●●●●● ●●● ●
●●●●●●●●●● ●●● ● ●
● ●
● ●
●●

● ●
● ●● ●
●●● ● ● ●●
● ●
● ● ●
●●● ●
● ●● ●●
●●●●● ●●
●● ●●

●●●● ●● ● ●
● ● ●
●●● ●
● ●
● ● ●●
● ● ●
●●
● ● ●
●●● ●
●●● ●●● ● ● ●
● ●●● ●●●● ●● ●●
●●●
●●
●●●● ●●●
●●●
●●●● ●●●●● ●●●
● ● ●


●●

● ●
● ●
●●

● ●
● ●
● ● ● ● ● ● ● ●
●●
●●●
●●
● ●●●
● ●●
● ●●●
●● ●●●●
●●● ●●●
●●● ●●●●
●●● ●● ●
● ●●●● ● ●
● ●

● ●
●●
● ●
● ●
● ●
● ●
●●● ●●
● ●
● ● ●●
● ●

● ●● ●●
● ● ●
●● ●
●●●●
●●●
● ●

●●●●●●●● ●●●
● ●●
● ●● ●●●●● ●
●●●●● ●●●● ●● ● ●
●●

●●
● ● ●
● ● ●
● ●
●●● ●
●●

● ● ●
● ●●
● ● ● ●
● ●●
● ●●
● ●●● ● ●● ●
●●● ●● ●
●●

●●●

●● ● ● ● ●
● ●
● ●
● ●
● ● ● ●
● ●
●●● ● ● ●● ● ●
● ● ●●●● ●●
●●●● ●

● ●●

●●●●
●●


●● ●●●

●●


●●●●●

●●
●●●
●●
●●●
●●
●●
●●●

●●●●
● ● ●● ● ● ● ●
● ●

●●
● ●●


●●
● ●
● ●
● ●
● ● ●

●●

● ●
● ● ●●
● ● ● ●●

● ●●● ●
●●●● ●●
● ●●
●●●


● ●
●●● ●●●
●●●●●
● ●
●● ●●●●
●●●● ●
●● ●●●●●● ●
●● ●

● ●
● ●



● ●●

● ● ●
● ●
●●

● ●●
● ● ●
● ●
● ●
●●

● ●●
● ●
●●●●●●●●●●
●●●
● ●


●●


●●


● ●
●●●
●●● ●

●●
●●
●●
●●●
●●
●●●
● ●
●●●
● ●●
● ●● ●●●●●● ●●● ●



● ●
● ●
● ●
● ●●● ●
● ● ●●
● ● ●●

● ● ●

● ●
●●● ● ●●●
● ●●
● ●● ●
●●
● ●
●●●●●
●●●
●● ●
●● ●
●● ●
●●
● ●
● ●●
●● ●
●●
●●
● ●
●●●●●●● ● ●●
● ● ●●
● ● ●
● ●
●●
● ● ●
● ●
● ● ● ● ● ●
●●
● ● ● ●

●●● ●

● ●●
●●●●
●●●
● ●
● ●
●● ●●
● ●






●●


●●
●●●
●●●
●●
●●●
●●
●●


●●
●● ●●
●●● ● ●● ● ●




● ●




● ●
● ●
● ● ●
● ●●

● ●●

● ● ●
●●
●● ● ●
● ● ●
●● ●
●●
●● ●●
●●
● ●●
● ●
●●●
●●●
●●
●●
●●●●
●●●
● ●●●

●●
● ●
●●●●● ●●●●●
● ● ●●● ●
● ● ●
● ●
● ● ●●
● ●
● ●
● ●●
● ● ● ●
● ●
● ● ●
● ●
●●
● ●
●●●
● ● ●
●●●●●
●●●●●●
● ●
●●●●
●●
●● ●

●●

●●●
●●
●●●
● ●●●
●●●
●●●
●●●●●●●●

●●

●● ●●
●● ● ●●
● ●


●●●
● ●
●●
● ●
● ●
● ●
● ●●● ●
●●● ●
●●
● ● ●●
● ● ●
● ● ● ●
●●● ●
● ●● ●●
●● ● ●●●
●●
●●●
●●●
● ●
●●
●●
● ●●
●●



●●
●●

●●
● ●
●●●
●●●
●●
● ●●
●●
●●●
● ●●●●●● ●● ●●

● ●

● ●●



● ●
● ●
● ● ●
● ●
●●●
● ●
● ● ● ●
●●●

● ●
● ● ●
● ●
●●

●●●
● ●



●●●
● ●

●●
●●
●●
●●●



●●
●●●

●●
●●



●●●
●●





●●●
●●



●●
●●
●●


●●●

●●
●●
●●●●●
● ●
●●●




●●





● ●

● ●


●●

●●




● ●
● ● ●
● ●●

● ● ●

●● ●● ● ●
●●
● ●
● ●
● ●
●●● ●● ●●●
● ●
● ●
●●● ●●● ●
●●●●●
●● ●●●●● ●
●●● ● ● ● ● ●
●● ●
● ● ●● ● ● ●●
● ● ● ●
20

20

●●
●●
●●●

●●●●
● ●
●●
●●●
● ●●
●●
●●●
●●
●●
●●●
●●●
●●
●●

●●

●●
●●
●●●
●● ●●
● ●
●● ●●●● ●
●●●
● ●

● ●
● ● ●
● ● ● ●
● ● ● ●●● ●
●●● ●
● ●
● ● ●
● ●●
● ●

●●●●●●●
●●●●●●● ●
● ●
●●●
● ●
●●●●●
●●● ●

●●

● ●

●●●●●●●
● ●●● ● ●● ● ● ●●
● ●
● ●

● ●
● ●
● ●
●●● ●
● ●
● ● ●
● ● ●●
● ● ●
● ●
●●●●●●

●●



●●●




●●●
●●●







●●●




●●
●●







●●●
●●
●●
●●●






●●









●●



●●●●●● ●


●●
● ●●

● ●

● ●●







● ●●

● ●
● ● ●



●●





●●

● ● ●

●● ●


●●
● ●


●●



●●
● ●
● ●● ●●●



●●





●●●





●●●







●●




●●●

●●
●●


●●
●●

●●




●●



●●


●●

●●●
●●



●●●●●●
● ●● ●● ● ● ●
● ●
●●


● ●






● ●
● ●
●●●




●●● ●
● ● ●

● ● ● ●
● ●●●
● ●
●●● ●
● ●● ●


●●


●●
● ●




●●
●●
●●
●●






●●●●





●●
●●●



●●
●●
●●●



●●
●●●●●
●●

●●●
●●
●● ●
●●
● ● ●●

● ●
● ●
● ●
● ●●●

●●
● ●

● ●
●● ●● ●
●● ●●
●●● ●
●●

● ●
● ● ●


●●
● ●●

●●
●●
●●●



●●
●●●


●●
● ●●

●●



●●●
●●

●●
● ●

●●●● ●
● ●●● ●

●●●

● ●
● ●





● ●
●●
● ● ●
●●●


●●
● ● ●
●●●
● ●


● ●● ● ●
● ● ●●
●● ●● ●● ●●●● ● ● ● ● ●
● ●●
● ●
●●● ●
●●●●
●●

●●



●●●




●●●
●●●
●●
●●

● ●●●●● ●● ●●●
● ●●●
● ●
● ●
● ●
● ●
● ● ●
● ● ●

●●
● ● ● ●● ● ●


●● ● ●

●●
●●
●●●●
● ●●
●●


● ●
●●●●
● ●● ●
●●●
● ● ●●
● ● ● ●●
● ● ●●
● ●● ●● ●
●●
●●●●●●● ●●●
● ●●
●●● ●● ● ●
● ●●
● ●

●●
●● ●● ●● ●
● ●
●●●●●●●
● ●●●●●● ●●● ●● ● ●

●●
● ● ● ● ●
●●●●●●●
●●●●
●● ● ●●

● ● ●
●●● ●
● ● ●● ●
● ●
● ●

● ●●● ●●
● ●

40 60 80 100 140 1.4 1.6 1.8 2.0


Weight (kg) Height (m)

positively associated not associated


2 / 17
C ASE 2: QUANTITATIVE AND CATEGORICAL
VARIABLES

• You can be interested in examining quantitative variable


across different groups.
• When describing quantitive variable across groups, the
tools you use are not different from what we have learned
so far.
• Just make a numerical plot ( do you remember the
plots?) for each group in the same graph. For example,
side-by-side box plots and hollow histograms are shown
slides 4 and 5.
• In addition, you can report the mean and standard
deviation for each group (or median and IQR) similar to
how you have described for individual quantitative
variables.

3 / 17
I S THERE AN ASSOCIATION ?

● ●

● ●

50





● ●
● ●
● ●

● ●

● ●

● ●

● ●

● ●

● ●
40

● ●



● ●

● ●



● ●


● ●



● ●



● ●



● ●

● ●


● ●




● ●


BMI


● ●


● ●




3020

female male

4 / 17
I S THERE AN ASSOCIATION ?

● ●

● ●

50





● ●
● ●
● ●

● ●

● ●

● ●

● ●

● ●

● ●
40

● ●



● ●

● ●



● ●


● ●



● ●



● ●



● ●

● ●


● ●




● ●


BMI


● ●


● ●




3020

female male

Does the BMI in general differ


between the two groups?

4 / 17
I S THERE AN ASSOCIATION ?

● ●
● ●
● ●

50
● ●

2.0
● ●
● ●

● ● ● ●
● ● ● ●
● ●

● ●

● ●

● ● ●

● ●

● ●
● ●
● ●
40

● ●



● ● ●

● ●

● ●

1.8

● ●

Height (m)

● ●



● ●



● ●



● ●

● ●


● ●




● ●


BMI


● ●


● ●




30

1.6




20

1.4
● ●




● ●

female male female male

Does the BMI in general differ


between the two groups?

4 / 17
I S THERE AN ASSOCIATION ?

● ●
● ●
● ●

50
● ●

2.0
● ●
● ●

● ● ● ●
● ● ● ●
● ●

● ●

● ●

● ● ●

● ●

● ●
● ●
● ●
40

● ●



● ● ●

● ●

● ●

1.8

● ●

Height (m)

● ●



● ●



● ●



● ●

● ●


● ●




● ●


BMI


● ●


● ●




30

1.6




20

1.4
● ●




● ●

female male female male

Does the BMI in general differ Does the height in general differ
between the two groups? between the two groups?

4 / 17
I S THERE AN ASSOCIATION ?

● ●
● ●
● ●

50
● ●

2.0
● ●
● ●

● ● ● ●
● ● ● ●
● ●

● ●

● ●

● ● ●

● ●

● ●
● ●
● ●
40

● ●



● ● ●

● ●

● ●

1.8

● ●

Height (m)

● ●



● ●



● ●



● ●

● ●


● ●




● ●


BMI


● ●


● ●




30

1.6




20

1.4
● ●




● ●

female male female male

Does the BMI in general differ Does the height in general differ
between the two groups? between the two groups?

In addition to the visual analysis you can formally test whether


the quantitative variable’s distribution differs across different
groups (later).
4 / 17
P OLL
• In your data, there are 1,454 counties where the population
increased from 2010 to 2017. The remaining 1,672 counties
had no gain in population.
• Suppose that you have obtained a random sample of 100
counties from the first group (increased population) and 50
from the other group. The plots below describe the
distribution of the median income.

5 / 17
Is there an association between median income and the
change in population?
a Yes the two variables are associated.
b No the two variables are independent.

6 / 17
C ASE 3: T WO CATEGORICAL VARIABLES

• When describing two (multiple) categorical variables


contingency table and proportions can be useful.
• Bar and mosaic plots can be useful as well.
• A table that summarizes data for two categorical variables
is called a contingency table.
• The contingency table below shows the distribution of
survival and age of passengers on the Titanic.

Survival
Died Survived Total
Age Adult 1438 654 2092
Child 52 57 109
Total 1490 711 2201

7 / 17
R OW PROPORTION
• Here we would like to know whether the survival rate
differs between adult and child to find out whether the
two variables are associated.
• Out of 2092 total adult, 654 survived. Hence the survival
rate for the Adult is 654/2092=0.31.
• Out of 109 children, 57 survived. Hence the survival rate
for the children is 0.52.
• Children were more likely to survive. The two variables
are associated.
• To formally claim this hypothesis test should be performed
due to sampling variability (later).
• Relevant descriptive statistics are the conditional
proportions. Especially in the current example it would be
the row proportion.

8 / 17
C OLUMN P ROPORTION

Carried Weapon Males Females Total


Yes 1046 274 1320
No 3159 4003 7162
Total 4205 4277 8482

• Suppose that you want to know whether the likelihood of


carrying weapons differs between males and females.
• Relevant descriptive statistics are the conditional
proportions and specifically the column proportion.
✓ 1046 out of 4205 males carried weapons to school,
1046/4205=0.248.
✓ 274 out of 4277 females carried weapons to school,
274/4277=0.064.
• The two variables are associated (formal test required).

9 / 17
P OLL
Bullied
Carried Weapon Yes Not Total
Yes 312 1008 1320
No 1331 5831 7162
Total 1643 6839 8482
Suppose that you are interested in finding out whether the likelihood
of carrying weapon depends on the experience being bullied.

10 / 17
P OLL
Bullied
Carried Weapon Yes Not Total
Yes 312 1008 1320
No 1331 5831 7162
Total 1643 6839 8482
Suppose that you are interested in finding out whether the likelihood
of carrying weapon depends on the experience being bullied.

Which would be the relevant statistic to compare?

A. 1643 vs 6839
B. 312 vs 1008
C. 312/1320 vs 1331/7162
D. 312/1643 vs 1008/6839
E. 1643/8482 vs 6839/8482
F. 1320/8482 vs 1643/8482

10 / 17
• 312/1643 = 0.19 and 1008/6839 = 0.15. It seems that the
two variables are related. (We need formal testing. More on
this later)
• Is it easy to tell whether the two variables are associated
from the two separate bar plots below?
100

100
Percent that carried a weapon

Percent that carried a weapon


80

80
60

60
40

40
20

20
0

female male yes no


Bullied

11 / 17
B AR PLOTS AND MOSAIC PLOT WITH TWO ( OR MORE )
CATEGORICAL VARIABLES

• Stacked bar plot


• Side-by-side bar plot
• Standardized stacked bar plot
• Mosaic plot

12 / 17
• The example of the distribution of survival and ages of
passengers on the Titanic (revisited)

Survival
Died Survived Total
Age Adult 1438 654 2092
Child 52 57 109
Total 1490 711 2201

Next slide contains three different types of bar plots which


describe the two categorical variables together.

13 / 17
T HREE DIFFERENT TYPES OF BAR PLOTS

Stacked Side-by-side
1500
2000

1500 1000
Frequency

Frequency
Survival Survival

1000 Died Died


Survived Survived
500
500

0 0
Adult Child Adult Child
Age Age

Standardized and stacked


1.00
Relative frequency

0.75

Survival
0.50 Died
Survived

0.25

0.00
Adult Child
Age

14 / 17
• The standardized stacked plot is good for finding out the
association. However we lose exact numbers and cannot
tell whether the sample had higher proportion of adults
than the children.

15 / 17
M OSAIC PLOTS

• A mosaic plot is similar to standardized stacked bar plot


but keeps the relative proportion of each group.
• Unlike side-by-side or stacked bar plots the exact numbers
are still lost.
Adult Child

Died

Survived

16 / 17
stacked & standardized mosaic
1.00

Adult Child
Relative frequency

0.75

Survival
0.50 Died
Died
Survived

0.25

0.00
Survived
Adult Child
Age

17 / 17

You might also like