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] Standard deviation: > sd(proportionforprop8) [1] Five-number summary: > fivenum(proportionforprop8) [1]
Histogram
Dot Chart
Box Plot
Stem and Leaf The decimal point is 1 digit(s) to the right of the | 2 | | | | | |
Strip Plot
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
Plots of Two Variables 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)
Z-scores and the normal Turn to next slide set.