histograms - university of california, berkeleyrice/oldstat20_s98/chapt3.pdf · 1998-01-23 ·...
Post on 10-Jul-2020
2 Views
Preview:
TRANSCRIPT
1
Histograms
2
Histogram of Just the Women
3
Histograms with Equal Bin Widths
bins
4
Birthweights of 1230 Male Babies
50 100 150 2000
10
20
30
40
50
60100 bins
50 100 150 2000
20
40
60
80
10050 bins
50 100 150 2000
50
100
150
20020 bins
50 100 150 2000
100
200
300
400
500
600
7005 bins
5
Babies of Smokers and Nonsmokers:Histograms of Weights
40 60 80 100 120 140 160 1800
50
100
150
200nonsmokers
40 60 80 100 120 140 160 1800
20
40
60
80
100
120smokers
6
Comparison of Gestation Ages
150 180 210 240 270 300 330 3600
50
100
150
200
250
gestation of non-smokers
150 180 210 240 270 300 330 3600
50
100
150
200
gestation of smokers
7
name m f r type calories protein fat sodium f iber carbo sugars potass vitami shelf weight cups rating100%_Bran N C 7 0 4 1 1 3 0 1 0 5 6 2 8 0 2 5 3 1 0.33 68.402973100%_Natura Q C 1 2 0 3 5 1 5 2 8 8 1 3 5 0 3 1 1 33.983679Al l -Bran K C 7 0 4 1 2 6 0 9 7 5 3 2 0 2 5 3 1 0.33 59.425505All-Bran_with K C 5 0 4 0 1 4 0 1 4 8 0 3 3 0 2 5 3 1 0.5 93.704912Almond_DelighR C 1 1 0 2 2 2 0 0 1 1 4 8 - 1 2 5 3 1 0.75 34.384843Apple_CinnamoG C 1 1 0 2 2 1 8 0 1.5 10.5 1 0 7 0 2 5 1 1 0.75 29.509541Apple_Jacks K C 1 1 0 2 0 1 2 5 1 1 1 1 4 3 0 2 5 2 1 1 33.174094Basic_4 G C 1 3 0 3 2 2 1 0 2 1 8 8 1 0 0 2 5 3 1.33 0.75 37.038562Bran_Chex R C 9 0 2 1 2 0 0 4 1 5 6 1 2 5 2 5 1 1 0.67 49.120253Bran_Flakes P C 9 0 3 0 2 1 0 5 1 3 5 1 9 0 2 5 3 1 0.67 53.313813Cap'n'Crunch Q C 1 2 0 1 2 2 2 0 0 1 2 1 2 3 5 2 5 2 1 0.75 18.042851Cheerios G C 1 1 0 6 2 2 9 0 2 1 7 1 1 0 5 2 5 1 1 1.25 50.764999Cinnamon_Toa G C 1 2 0 1 3 2 1 0 0 1 3 9 4 5 2 5 2 1 0.75 19.823573Clusters G C 1 1 0 3 2 1 4 0 2 1 3 7 1 0 5 2 5 3 1 0.5 40.400208Cocoa_Puffs G C 1 1 0 1 1 1 8 0 0 1 2 1 3 5 5 2 5 2 1 1 22.736446Corn_Chex R C 1 1 0 2 0 2 8 0 0 2 2 3 2 5 2 5 1 1 1 41.445019Corn_Flakes K C 1 0 0 2 0 2 9 0 1 2 1 2 3 5 2 5 1 1 1 45.863324Corn_Pops K C 1 1 0 1 0 9 0 1 1 3 1 2 2 0 2 5 2 1 1 35.782791Count_Chocula G C 1 1 0 1 1 1 8 0 0 1 2 1 3 6 5 2 5 2 1 1 22.396513Cracklin'_Oat_K C 1 1 0 3 3 1 4 0 4 1 0 7 1 6 0 2 5 3 1 0.5 40.448772Cream_of_Wh N H 1 0 0 3 0 8 0 1 2 1 0 - 1 0 2 1 1 64.533816Crispix K C 1 1 0 2 0 2 2 0 1 2 1 3 3 0 2 5 3 1 1 46.895644Crispy_Wheat_G C 1 0 0 2 1 1 4 0 2 1 1 1 0 1 2 0 2 5 3 1 0.75 36.176196
Contents of 77 Breakfast Cereals
8
Histograms
50 100 150 2000
5
10
15
20
25
30
calories0 5 10 15
0
5
10
15
20
25
30
35
grams of fiber
0 5 10 150
2
4
6
8
10
12
14
grams of sugars0 5 10 15 20 25
0
5
10
15
grams complex carbohydrates
9
The Vertical Axis of a Histogram
• Previous examples used counts in each bin, which is common. Comparisons are then difficult
• Book: area under histogram = 100%• Another alternative: area = 1
10
Constructing a 100% Area Histogram
• Calculate percentage in each bin (“class interval”)
• Divide each percentage by the bin width, giving the height of the bar (“block”) over that bin
11
Reported minus Actual GPA
What’s wrong with this histogram?
Class Interval Percent
-2.0 -- -.4 2.3
-.4 -- -.2 5.5
-.2 -- -.1 9.7
-.1 -- 0.0 21.0
0.0 -- .1 18.9
.1 -- .2 13.9
.2 -- .4 11.6
.4 -- .2 17.1
12
Interval Percent W idth Density
-2.0 -- -.4 2.3 1.6 1.4
-.4 -- -.2 5.5 .2 27.5
-.2 -- .1 9.7 .1 97.0
-.1 -- 0.0 21.0 .1 210.0
0.0 -- .1 18.9 .1 189.0
.1 -- .2 13.9 .1 139.0
.2 -- .4 11.6 .2 58.0
.4 -- 2.0 17.1 1.6 10.7
Density = Percent
Width
13
Bar Graphs:
Which face is happier?
14
15
How to Lie with a Bar Graph
top related