120 likes | 241 Views
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.
E N D
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
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
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)
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.