A radical view on plots in analysis
description
Transcript of A radical view on plots in analysis
A radical view
on plots in analysis
Hein Stigum
Presentation, data and programs at:
http://folk.uio.no/heins/
Agenda
• Why use graphs
• Common use
• A graphic evolution
• Plots in analysis
04/22/23 H.S. 2
Why use graphs?
04/22/23 H.S. 4
Problem example• Lunch meals per week
– Table of means (around 5 per week)
– Linear regression0
1020
3040
50P
erce
nt
1 2 3 4 5 6 7Lunch meals per week
04/22/23 H.S. 5
Problem example 2• Iron level
– Linear regression: Males 9.4 units higher iron level
– Logistic regression: Males 10.4 times more anemia
125115
Ma
le m
ea
n
Fe
ma
le m
ea
n
50 cutoff 90 150 190Iron level
Iron level by sex
04/22/23 H.S. 6
Problem example 3
• Weight on blood pressure
_cons 10.944734 -28.388124 Males 9.67202 weight10 15.632724 20.618903 Variable Crude Adjusted
Adjusted 199 -1011.745 -963.3133 3 1932.627 1942.507 Crude 200 -1018.258 -993.7326 2 1991.465 1998.062 Model Obs ll(null) ll(model) df AIC BIC
5010
015
020
025
0B
lood
pre
ssur
e
50 100 150weight
Missing sex
Common use
Pie and bar
04/22/23 H.S. 8
Measure 1
Measure 2
Measure 3
01
23
mean of v1 mean of v2 mean of v3
Bar-Dot-Line evolution
04/22/23 H.S. 9
01
23
4
0 1 2 3+
mean of v1 mean of v2 mean of v3
01
23
4
0 1 2 3+Parity
(mean) v1 (mean) v2 (mean) v3
01
23
4
0 1 2 3+Parity
(mean) v1 (mean) v2 (mean) v3
The workhorses:Scatter and density
Scatterplot10
0020
0030
0040
0050
00B
irth
wei
ght
250 260 270 280 290 300 310Gestational age
1000
2000
3000
4000
5000
Birt
h w
eigh
t
250 260 270 280 290 300 310Gestational age
1000
2000
3000
4000
5000
Birt
h w
eigh
t
250 260 270 280 290 300 310Gestational age
04/22/23 H.S. 12
Density
• Density– kdensity weight
• Boxplot– graph hbox weight
0 2000 4000 6000weight
0 2,000 4,000 6,000weight
04/22/23 H.S. 13
Density with “boxplot” information
min w 25% 50% 75% w max
200 3180 3940 53502040 3600 5080
WeightN=583
04/22/23 H.S. 14
Scatter and density plots for many types of data
Y-type X-type Scatter DensityCont xCont Cont xCont Cat x x
Binary Cont x
x-normal usex-suggested use
Plots in analysis
Continuous outcome
04/22/23 H.S. 17
Continuous by 1 category
min w 25% 50% 75% w max
200 3180 3940 53502040 3600 5080
WeightN=583
Continuous by 2 categories20
0030
0040
0050
0060
00B
irth
wei
ght
Boy Girlsex
• Is birth weight the same for boys and girls?
Scatterplot Density plot
2000 3000 4000 5000 6000Birth weight
Equal means? Linear effect?Outliers?
Equal variances?
04/22/23 H.S. 19
Continuous by 3 categories
• Is birth weight the same over parity?
Scatterplot Density plot
2000
3000
4000
5000
6000
Birt
h w
eigh
t
0 1 2-7Parity
2000 3000 4000 5000 6000Birth weight, g
012+
Equal means? Linear effect?Outliers?
Equal variances?
04/22/23 H.S. 20
Continuous by continuous
• Does birth weight depend on gestational age?Scatterplot Density plot
Equal means? Linear effect?Outliers?
1000
2000
3000
4000
5000
Birt
h w
eigh
t
250 260 270 280 290 300 310Gestational age
Binary outcome
Binary by 2 categories
• Does the low birth weight depend on sex?0
.2.4
.6.8
1L
ow b
irth
we
ight
Boy Girlsex
0.2
.4.6
.81
Low
birt
h w
eig
ht
Boy Girlsex
0.2
.4.6
.81
Boy Girlsex
Jitterandline
Binary by 3 categories
• Does the low birth weight depend on parity?0
.2.4
.6.8
1
0 1 2+Parity
Binary by 3 categories, no scatter
0.0
4.0
8.1
2P
ropo
rtio
n lo
w b
irth
wei
ght
0 1 2+Parity
• Does the low birth weight depend on parity?
04/22/23 H.S. 25
Scatter: binary by countinuous
-.5
0.5
11
.5P
ropo
rtio
n lo
w b
irth
we
ight
100 150 200 250 300Gestational age
• Does the low birth weight depend on gest. age?