1 / 13

POL 51: Scientific Study of Politics

POL 51: Scientific Study of Politics. Prof. B. Jones Dept. of Political Science UC-Davis. Plots and Z-scores. How to do some of the “stuff” in HW 4 Multiple plots on a single page Creating z-scores and finding p -values Visualizing political data Data: Obama vote share by county.

Télécharger la présentation

POL 51: Scientific Study of Politics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. POL 51: Scientific Study of Politics Prof. B. Jones Dept. of Political Science UC-Davis

  2. Plots and Z-scores • How to do some of the “stuff” in HW 4 • Multiple plots on a single page • Creating z-scores and finding p-values • Visualizing political data • Data: Obama vote share by county

  3. dotchart(obamapercent, labels=row.names, cex=.7, xlim=c(0, 100), main="Support for Obama", xlab="Percent Obama") abline(v=50) Returns: Dot Chart: Obama Vote

  4. Interpretation? • Geographical Patterns? • Central Valley • Coastal • SoCal, NorCal? • Why might you observe these patterns? • Z-scores • NB: we’re doing this for learning purposes

  5. Z-scores • Easy: create mean, standard deviation • Then derive z-score using formula from last slide set: • R code on next slide

  6. Z-scores and R #Z scores for Obama meanobama<-mean(obamapercent) sdobama<-sd(obamapercent) zobama<-(obamapercent-meanobama)/sdobama

  7. Interpretation • Z-scores in metric of standard deviations • Large z imply the observation is further away from mean than observations with small z. • Z=0 means the observation is exactly at the mean. • Dotchart (code): par(mfcol=c(1,1)) dotchart(zobama, labels=row.names, cex=.7, xlim=c(-3, 3), main="p-values for Obama Vote Z-scores", xlab="Probability") abline(v=0) abline(v=1, col="red") abline(v=-1, col="red") abline(v=2, col="dark red") abline(v=-2, col="dark red")

  8. Probability Values • High Z-scores are probabilistically less likely to be observed than smaller scores. • Consult a z-distribution table • Probability area is given • Can think about probabilities in the “tails” • One-tail (upper or lower) • Two-tail (upper + lower) • R

  9. R code twotailp<- 2*pnorm(-abs(zobama)) #Gives us area in the upper and lower tails of z onetailp<- pnorm(-abs(zobama)) #Gives us 1-tail probability area; if #subtract this from 1, this give us the area #below this z score (if z is positive) or #area above this z score (if z is negative) zp<-cbind(county, onetailp, twotailp, zobama ); zp

  10. Plots • 4 plots on one page: par(mfcol=c(2,2)) boxplot(obamapercent, ylab="Vote Percent", main="Obama Vote: Box Plot", col="blue") hist(zobama, xlab="Obama Vote as Z-Scores", ylab="Frequency", main="Histogram of Standardized Obama Vote", col="blue") hist(obamapercent, ylab="Frequency", xlab="Vote Percent", main="Obama Vote: Histogram", col="blue") plot(zobama, onetailp, ylab="One-Tail p", xlab="Z-score", main="Z-scores and p-values", col="blue")

More Related