Skip to content

Instantly share code, notes, and snippets.

@Rharald
Created November 9, 2012 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rharald/4043804 to your computer and use it in GitHub Desktop.
Save Rharald/4043804 to your computer and use it in GitHub Desktop.
crosshairs2.R
# numbers from http://news.cnet.com/8301-13578_3-57546778-38/among-the-top-election-quants-nate-silver-reigns-supreme/
nate <- c(50.8, 48.3)
tpm <- c(48.8, 48.1)
rcp <- c(48.8, 48.1)
huff <- c(48.1, 46.7)
png('crosshairs2.png')
crosshairs(centre = centre, # the actual popular vote
pts = pts, # the predistions
no.rings = 4, # four rings seem about right here ("4 more years")
title = "Pollsters on target?",
x.ann = "Obama popular vote (%)", # annotation for x axis
y.ann = "Romney popularvote (%)" # annotation for y axis
)
points(nate[1], nate[2], col = "blue", pch = 22)
points(tpm[1], tpm[2], col = "black", pch = 22)
# as RCP and TPM actually have the same prediction, I'll use a different pch
points(rcp[1], rcp[2], col = "red", pch = 20)
points(huff[1], huff[2], col = "blue", pch = 22)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment