Skip to content

Instantly share code, notes, and snippets.

@xmarquez
Created August 24, 2012 05:10
Show Gist options
  • Save xmarquez/3445670 to your computer and use it in GitHub Desktop.
Save xmarquez/3445670 to your computer and use it in GitHub Desktop.
Quick and dirty simulation of votes in 2008 congressional election under inverse income voting system
# We use a lognormal income distribution to simulate the income distribution in the USA in 2008.
# The parameters are chosen so that the median income comes out to about $30,000,
# the gini index comes out to about 0.35, and the 90/10 ratio comes in at about 6:1,
# as in the Luxembourg Income Study figures for 2010.
# See the key figures here: http://www.lisdatacenter.org/data-access/key-figures/inequality-and-poverty/
incomes <- rlnorm(300000,meanlog=log(30000),0.55)
require(reldist) # to calculate the gini index
gini(incomes)
# should come out around 0.3, which is a bit lower than the 0.37 the LIS gives for the USA in 2010
# Voting system parameters. x is the sensitivity of the system to income inequality
# (the "disenfranchisement parameter"); n is the number of classes of voters.
# With n = 10, we have deciles; with x = 1, we have voting power inversely proportional to income.
n <- 10
x <- 1
# We now calculate the median income of each class of voters
spacing <- 1/n
first.midpoint <- spacing/2
midpoints <- quantile(incomes,seq(first.midpoint,
1-first.midpoint,
spacing))
# And we are now ready to calculate the relative weight of votes in each class
votes <- (midpoints[1]/midpoints)^x
# Here we approximate the democratic vote shares per decile, using this data from ANES:
# http://electionstudies.org/nesguide/2ndtable/t9b_1_1.htm. (This is not exact).
# Lowest decile voted about 75% democratic; highest decile voted about 33% democratic
dem.vote.shares.08 <- seq(from=0.75,
by=-0.04234,
length.out=n)
# Here we approximate the turnout per decile, using this data from ANES:
# http://electionstudies.org/nesguide/2ndtable/t6a_2_2.htm. (This is not exact).
# Lowest decile had turnout of about 65%; highest decile had turnout of about 89%.
# This is probably overstated.
turnout.08 <- seq(from=0.65,by=0.02,length.out=10)
# This is the Democratic share of the vote we would expect with the existing voting system
original.result <- weighted.mean(dem.vote.shares,turnout.08)
# should be about 0.55, which is close to the 54% of the vote that the Democrats actually got in
# the 2008 congressional election. See http://electionstudies.org/nesguide/toptable/tab9b_1.htm
# This is the Democratic share of the vote we would expect with an inverse income voting system,
# not taking differential turnout into account
result.no.turnout <- weighted.mean(dem.vote.shares.08,votes)
# should be about 0.62 (62%), about 7% points bigger than the actual Democratic share
# This is the Democratic share of the vote we would expect with an inverse income voting system,
# taking actual differences in turnout in 2008 into account
result.with.turnout <- weighted.mean(dem.vote.shares.08,votes*turnout.08)
# should be about 0.61 (61%)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment