Princeton Election Consortium

Innovations in democracy since 2004

Outcome: Biden 306 EV (D+1.2% from toss-up), Senate 50 D (D+1.0%)
Nov 3 polls: Biden 342 EV (D+5.3%), Senate 50-55 D (D+3.9%), House control D+4.6%
Moneyball states: President AZ NE-2 NV, Senate MT ME AK, Legislatures KS TX NC

Senate_median.m, July 11 2014

%%%%%%%%%%%%%%%%%%%%%%%%%%% The calculation %%%%%%%%%%%%%%%%%%%%%%%%
% Changes for Senate projection
% make the histogram num_states wide
% use EV variable to give 1 seat per race (keep variable name same)
% Calculate z-score and convert to probability, assuming normal distribution.

% The meta-magic
EV_distribution=[1-polls.prob_Dem_win(1) polls.prob_Dem_win(1)];
for i=2:num_states
nextEV=[1-polls.prob_Dem_win(i) polls.prob_Dem_win(i)];
clear nextEV
% EV_distribution is the exact probability distribution of
% all 2,251,799,813,685,248 (2.3 quadrillion) possible outcomes. (Wow!)
% 5 July 2014: code is same for Senate. In 2014, 36 races with 11 races in
% question. Therefore 2^11=2048 possibilities.

% Cumulative histogram of all possibilities
histogram=EV_distribution(2:num_states+1); %index of 1 for 1 Dem/Ind seat…num_states for num_states seats
% Truncate distribution by 1, which implicitly assumes at least one race will go to Democrats.
% Seems ok, since otherwise we wouldn’t bother doing a simulation.

% Calculate properties of distribution using cumulative histogram
% 5 July 2014: All variables below this line are new relative to EV_median.m
% if Democrats/Independents get 49 or fewer, Republicans take over
% 49 because VP Biden is a Democrat. will need Demsafe from other script
% 50 in years when VP is a Republican.
median_seats(1)=Senateseats(min(find(cumulative_prob>=0.5))); % 50% of outcomes

% Still paranoid that my indexing is off by 1. Keep an eye on that.
% Also got rid of fliplr(), what was I thinking???