Skip to content

Instantly share code, notes, and snippets.

@jonrobinson2
Created July 31, 2020 12:46
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 jonrobinson2/e69e766ac0275c1c00b912f823063fd4 to your computer and use it in GitHub Desktop.
Save jonrobinson2/e69e766ac0275c1c00b912f823063fd4 to your computer and use it in GitHub Desktop.
wasserman_rejections = function(by_mail=.8,rejection=.04,
total_votes=2000000,
dem_pct=.65,pre_d_2way=.52){
rejections = (((total_votes*by_mail)*rejection))
pre_rej_vote = c(total_votes*pre_d_2way,total_votes*(1-pre_d_2way))
post_rej_vote = c((total_votes*pre_d_2way) - ((rejections * dem_pct)),
(total_votes*(1-pre_d_2way)) - ((rejections * (1-dem_pct))))
list(pre_rej_vote,
pre_rej_vote/sum(pre_rej_vote),
post_rej_vote,
post_rej_vote/sum(post_rej_vote),
c(((post_rej_vote/sum(post_rej_vote)) - (pre_rej_vote/sum(pre_rej_vote)))*100)[1]
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment