POL 51: Scientific Study of Politics

Download Report

Transcript POL 51: Scientific Study of Politics

POL 51: Scientific
Study of Politics
Professor B. Jones
UC-Davis
Dept. of Political Science
Univariate Quantities in R

Our Data


Yes on Proposition 8 by County
Graphical Displays of data
Histogram
 Dot Chart
 Box Plots
 Stem and Leaf
 Strip Plot

First, the basic statistics in R



Mean (by county):
 > mean(proportionforprop8)
 [1] 56.7202
Standard deviation:
 > sd(proportionforprop8)
 [1] 13.39508
Five-number summary:
 > fivenum(proportionforprop8)
 [1] 23.50787 46.93203 59.25364 68.03883
75.37070
Histogram
0
5
Frequency
10
15
Histogram of Yes on 8 by County
20
30
40
50
60
Percentage Yes on Prop. 8
70
80
Dot Chart
Yes on 8 by County
Tulare
Kern
Modoc
Kings
Madera
Glenn
Tehama
Colusa
Merced
Lassen
Sutter
Imperial
Shasta
Fresno
Stanislaus
Yuba
San Bernardino
San Joaquin
Riverside
Amador
Sierra
Calaveras
Tuolumne
Mariposa
Inyo
Del Norte
Siskiyou
Plumas
Placer
El Dorado
Orange
Butte
Trinity
Solano
San Benito
San Diego
Sacramento
Ventura
Lake
San Luis Obispo
Nevada
Los Angeles
Monterey
Santa Barbara
Contra Costa
Napa
Mono
Santa Clara
Alpine
Yolo
Humboldt
Alameda
Mendocino
San Mateo
Sonoma
Santa Cruz
Marin
San Francisco
0
20
40
60
Percent Yes
80
100
Box Plots for Prop. 8 by County
50
40
30
Percent Yes on 8
60
70
Box Plot
California Counties
Source: Los Angeles Times
Stem and Leaf
The decimal point is 1 digit(s) to the right
of the |
2 | 459
3 | 4888
4 | 024445578
5 | 0113344566779
6 | 0000023344457889
7 | 0011123334455
Strip Plot
Vote on Prop. 8 by County: Strip Chart
30
40
50
Percentage Yes on Prop. 8
60
70
R Code for Previous
row.names<- cbind(county)
hist(proportionforprop8, xlab="Percentage Yes on Prop.
8", ylab="Frequency", main="Histogram of Yes on 8 by
County", col="yellow")
dotchart(proportionforprop8, labels=row.names,
cex=.7, xlim=c(0, 100), main="Yes on 8 by County",
xlab="Percent Yes")
abline(v=50)
abline(h=16)
boxplot(proportionforprop8, col="light blue",
names=c("Proposition 8"), xlab="California Counties",
ylab="Percent Yes on 8", main="Box Plots for Prop. 8
by County", sub="Source: Los Angeles Times")
abline(h=50)
stem(proportionforprop8)
stripchart(proportionforprop8, method="stack",
xlab="Percentage Yes on Prop. 8", main="Vote on
Prop. 8 by County: Strip Chart", pch=1)
Combined
Box Plots for Prop. 8 by County
60
50
30
40
Percent Yes on 8
10
5
0
Frequency
70
15
Histogram of Yes on 8 by County
20
30
40
50
60
70
80
Percentage Yes on Prop. 8
California Counties
Source: Los Angeles Times
Yes on 8 by County
Vote on Prop. 8 by County: Strip Chart
Tulare
Kern
Modoc
Kings
Madera
Glenn
Tehama
Colusa
Merced
Lassen
Sutter
Imperial
Shasta
Fresno
Stanislaus
Yuba
San Joaquin
Bernardino
San
Riverside
Amador
Sierra
Calaveras
Tuolumne
Mariposa
Inyo
Del
Norte
Siskiyou
Plumas
Placer
El
Dorado
Orange
Butte
Trinity
Solano
San
Benito
San
Diego
Sacramento
Ventura
Lake
San
Luis Obispo
Nevada
Los
Angeles
Monterey
Santa Barbara
Contra
Napa Costa
Mono
Santa Clara
Alpine
Yolo
Humboldt
Alameda
Mendocino
San
Mateo
Sonoma
Santa Cruz
Marin
San Francisco
0
20
40
60
Percent Yes
80
100
30
40
50
60
Percentage Yes on Prop. 8
70
Plots of Two Variables
50
40
30
plot(proportionforprop8, proportionforprop4,
xlab="Prop. 8 Vote", ylab="Prop. 4 Vote",
main="Prop. 8 Vote by Prop. 4 Vote“, col=“red”)
> abline(h=50)
> abline(v=50)
Prop. 4 Vote
60
70
Prop. 8 Vote by Prop. 4 Vote
30
40
50
Prop. 8 Vote
60
70
Z-scores and the normal

Turn to next slide set.