+ Reply to Thread
Results 1 to 3 of 3

Thread: 2012 Presidential Election Probability Calculator

  1. #1
    Points: 755, Level: 14
    Level completed: 55%, Points required for next Level: 45

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    2012 Presidential Election Probability Calculator




    I'm trying to create a calculator to determine odds of Democrats winning the 2012 US Presidential election. I take the electoral college map from 2008 and leave 38 States +DC the same (and switch the one EC vote from NE's 2nd CD back to Republicans) and put the remaining 12 states in play. I want to be able to enter the percentage chance of Democrats winning each of those 12 states, and have it calculate the odds of Democrats winning the whole election. 270towin.com provided me with 325 combinations of Democrats winning in this scenario - http://www.270towin.com/presidential...,NV,NH&me=&ne=

    I tried to convert these combinations into an algorithm, which I will paste below, but the algorithm seems defective.

    I think it's a problem with my statistical methodology;
    I think it has to do with over-applying combinations.

    For example, if I set MI, NC, and VA to 100%, Florida would be enough to win, so if I set Florida to 50% (leaving everything else at 0), the odds are 50%. But, if I change IN to 100%, the odds change to 75%, when it should still be 50%, because FL is still the only deciding factor, and FL is still at 50%. It seems like changing IN from 0% to 100% puts more combinations in play, and increases the odds, when it shouldn't. So, it would seem my methodology was wrong, but I'm still not sure how to do it correctly. I'm hoping someone could guide me in the right direction on how to do this.

    Here is my algorithm (though I'm thinking I may have to start from scratch, which is fine, but I thought I should include my algorithm anyway in case it's a better starting point than scratch - to understand the combinations, it may be helpful to go to http://www.270towin.com/presidential...,NV,NH&me=&ne=). The state's abbreviations represent the percentage chance of Democrats winning that state. This get's converted into a decimal variable, starting with the letter 'r', such as "rFL" (so if the odds of winning florida are set at 25%, rFL=0.25; inverse variables - the odds of Democrats losing the state - are also created, starting with the letter 'i' - so, respectively, iFL=0.75


    Let ( [ rfl= fl/100 ;rpa= pa/100 ;roh= oh/100 ;rmi= mi/100 ;rnc= nc/100 ;rva= va/100 ;rin= in/100 ;rwi= wi/100 ;rco= co/100 ;rnv= nv/100 ;ria= ia/100 ;rnh= nh/100 ] ;

    Let ( [ifl=1-rfl;ipa=1-rpa;ioh=1-roh; imi=1-rmi;inc=1-rnc;iva=1-rva;iin=1-rin;iwi=1-rwi;ico=1-rco; inv=1-rnv;iia=1-ria;inh=1-rnh ] ;

    1-(



    (1-rFL*rPA*rOH*(1-(iMI*iNC*iVA*iIN*iWI*iCO*iIA*iNV*iNH)))
    *(1-rFL*rPA*rMI*(1-(iNC*iVA*iIN*iWI*iCO*iIA*iNV*iNH)))
    *(1-rFL*rPA*rNC*(1-(iVA*iIN*iWI*iCO*iIA*iNV)))
    *(1-rFL*rPA*rVA*(1-(iIN*iWI*iCO)))
    *(1-rFL*rPA*rIN*(1-(iWI*iCO)))
    *(1-rFL*rOH*rMI*(1-(iNC*iVA*iIN*iWI*iCO*iIA*iNV)))
    *(1-rFL*rOH*rNC*(1-(iVA*iIN*iWI*iCO)))
    *(1-rFL*rOH*rVA*(1-(iIN*iWI*iCO)))
    *(1-rFL*rMI*rNC*(1-(iVA*iIN*iWI*iCO)))
    *(1-rFL*rMI*rVA*rIN)
    *(1-rPA*rOH*rMI*rNC)
    *(1-rFL*rPA*rVA*rNV*rIA)
    *(1-rFL*rPA*rVA*rIA*rNH)
    *(1-rFL*rPA*rVA*rNV*rNH)
    *(1-rFL*rPA*rIN*rNV*rIA)
    *(1-rFL*rPA*rIN*rIA*rNH)
    *(1-rFL*rPA*rIN*rNV*rNH)
    *(1-rFL*rPA*rWI*rCO*(1-(iIA*iNV*iNH)))
    *(1-rFL*rPA*rWI*rNV*rIA)
    *(1-rFL*rPA*rWI*rIA*rNH)
    *(1-rFL*rPA*rWI*rNV*rNH)
    *(1-rFL*rPA*rCO*rNV*rIA)
    *(1-rFL*rOH*rNC*rNV*rIA)
    *(1-rFL*rOH*rNC*rIA*rNH)
    *(1-rFL*rOH*rNC*rNV*rNH)
    *(1-rFL*rOH*rVA*rNV*rIA)
    *(1-rFL*rOH*rVA*rIA*rNH)
    *(1-rFL*rOH*rVA*rNV*rNH)
    *(1-rFL*rOH*rIN*rWI*(1-(iCO*iIA*iNV*iNH)))
    *(1-rFL*rOH*rIN*rCO*(1-(iIA*iNV*iNH)))
    *(1-rFL*rOH*rIN*rNV*rIA)
    *(1-rFL*rOH*rWI*rCO*(1-(iIA*iNV*iNH)))
    *(1-rFL*rOH*rWI*rNV*rIA)
    *(1-rFL*rMI*rNC*rNV*rIA)
    *(1-rFL*rMI*rNC*rIA*rNH)
    *(1-rFL*rMI*rNC*rNV*rNH)
    *(1-rFL*rMI*rVA*rWI*(1-(iCO*iIA*iNV*iNH)))
    *(1-rFL*rMI*rVA*rCO*(1-(iIA*iNV*iNH)))
    *(1-rFL*rMI*rVA*rNV*rIA)
    *(1-rFL*rMI*rIN*rWI*(1-(iCO*iIA*iNV*iNH)))
    *(1-rFL*rMI*rIN*rCO*(1-(iIA*iNV*iNH)))
    *(1-rFL*rMI*rWI*rCO*(1-(iIA*iNV)))
    *(1-rFL*rNC*rVA*rIN*(1-(iWI*iCO*iIA*iNV*iNH)))
    *(1-rFL*rNC*rVA*rWI*(1-(iCO*iIA*iNV*iNH)))
    *(1-rFL*rNC*rVA*rCO*(1-(iIA*iNV*iNH)))
    *(1-rFL*rNC*rVA*rNV*rIA)
    *(1-rFL*rNC*rIN*rWI*(1-(iCO*iIA*iNV*iNH)))
    *(1-rFL*rNC*rIN*rCO*(1-(iIA*iNV)))
    *(1-rFL*rNC*rWI*rCO*(1-(iIA*iNV)))
    *(1-rFL*rVA*rIN*rWI*(1-(iCO*iIA*iNV)))
    *(1-rPA*rOH*rMI*rVA*(1-(iIN*iWI*iCO*iIA*iNV*iNH)))
    *(1-rPA*rOH*rMI*rIN*(1-(iWI*iCO*iIA*iNV*iNH)))
    *(1-rPA*rOH*rMI*rWI*(1-(iCO*iIA*iNV)))
    *(1-rPA*rOH*rMI*rCO*(1-(iIA*iNV)))
    *(1-rPA*rOH*rNC*rVA*(1-(iIN*iWI*iCO*iIA*iNV*iNH)))
    *(1-rPA*rOH*rNC*rIN*(1-(iWI*iCO*iIA*iNV)))
    *(1-rPA*rOH*rNC*rWI*(1-(iCO*iIA*iNV)))
    *(1-rPA*rOH*rVA*rIN*(1-(iWI*iCO)))
    *(1-rPA*rOH*rVA*rWI*rCO)
    *(1-rPA*rMI*rNC*rVA*(1-(iIN*iWI*iCO*iIA*iNV)))
    *(1-rPA*rMI*rNC*rIN*(1-(iWI*iCO)))
    *(1-rPA*rMI*rNC*rWI*rCO)
    *(1-rPA*rMI*rVA*rIN*(1-(iWI*iCO)))
    *(1-rPA*rNC*rVA*rIN*rWI)
    *(1-rOH*rMI*rNC*rVA*(1-(iIN*iWI*iCO)))
    *(1-rOH*rMI*rNC*rIN*(1-(iWI*iCO)))
    *(1-rFL*rOH*rCO*rIA*rNV*rNH)
    *(1-rFL*rMI*rIN*rIA*rNV*rNH)
    *(1-rFL*rMI*rWI*rIA*rNV*rNH)
    *(1-rFL*rMI*rCO*rIA*rNV*rNH)
    *(1-rFL*rNC*rIN*rIA*rNV*rNH)
    *(1-rFL*rNC*rWI*rIA*rNV*rNH)
    *(1-rFL*rNC*rCO*rIA*rNV*rNH)
    *(1-rFL*rVA*rIN*rCO*rNV*rIA)
    *(1-rFL*rVA*rIN*rCO*rIA*rNH)
    *(1-rFL*rVA*rIN*rCO*rNV*rNH)
    *(1-rFL*rVA*rIN*rIA*rNV*rNH)
    *(1-rFL*rVA*rWI*rCO*rNV*rIA)
    *(1-rFL*rVA*rWI*rCO*rIA*rNH)
    *(1-rFL*rVA*rWI*rCO*rNV*rNH)
    *(1-rFL*rIN*rWI*rCO*rNV*rIA)
    *(1-rFL*rIN*rWI*rCO*rIA*rNH)
    *(1-rFL*rIN*rWI*rCO*rNV*rNH)
    *(1-rPA*rOH*rMI*rIA*rNV*rNH)
    *(1-rPA*rOH*rNC*rCO*rNV*rIA)
    *(1-rPA*rOH*rNC*rCO*rIA*rNH)
    *(1-rPA*rOH*rNC*rCO*rNV*rNH)
    *(1-rPA*rOH*rNC*rIA*rNV*rNH)
    *(1-rPA*rOH*rVA*rIN*rNV*rIA)
    *(1-r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rIN*rWI*rCO*rNV*rIA)
    *(1-rMI*rVA*rIN*rWI*rCO*rIA*rNH)
    *(1-rMI*rVA*rIN*rWI*rCO*rNV*rNH)
    *(1-rNC*rVA*rIN*rWI*rCO*rNV*rIA)



    )))*100

  2. #2
    Points: 755, Level: 14
    Level completed: 55%, Points required for next Level: 45

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: 2012 Presidential Election Probability Calculator

    Just to add some notes on my thinking that led me to that algorithm/formula:

    I was thinking that the only way for Democrats to not win is for none of those 325 combinations (in that link) to happen, and that 1 minus the odds of none of those combinations happening would be Democrats' chances of winning. Then I thought to calculate the odds of none of those combinations happening, I would multiply the odds of each one not happening, which I would calculate as 1 minus the odds of the combination happening (which would be the product of the odds of winning all the necessary states in the combination, times [1 minus the product of the odds of losing the states of which only one is needed] (this sort of consolidates the 325 combinations into 184, which is how they were expressed on 270towin.com)).

    This method seemed perfect at first, but, as applied, something is clearly wrong. I don't really get it. In the example above -
    if I set MI, NC, and VA to 100%, Florida would be enough to win, so if I set Florida to 50% (leaving everything else at 0), the odds are 50%. But, if I change IN to 100%, the odds change to 75%, when it should still be 50%, because FL is still the only deciding factor, and FL is still at 50%. It seems like changing IN from 0% to 100% puts more combinations in play, and increases the odds, when it shouldn't.
    - (I could be wrong, but) only one of those 184 lines should be in play "*(1-rFL*rMI*rNC*(1-(iVA*iIN*iWI*iCO)))"

    (1-.5*1*1*(1-(0*1*1*1)))=.5
    and
    (1-.5*1*1*(1-(0*0*1*1)))=.5

    so I just don't get it.


    The issue comes up in infinite other examples too. If I set VA, IN ,WI, CO, IA, NV, and NH, all to 100%, Democrats only need one of the remaining 5 states to win. If I put NC at 50% (leaving the remaining 4 at 0%), the odds are 50% - so far so good - but if I then change MI from 0% to 50%, the odds jump to 99.5307207107543946% when it should be 75% (1-.5*.5). If I then change OH from 0% to 50% it becomes 99.9999562870521687% when it should be 87.5% (1-.5^3). If I then change PA from 0% to 50% it changes to 99.9999999999988245%, when it should be 93.75%. If I then change FL from 0 to 50%, it returns 100% (probably rounding up from 100-1/infiniti-ish), when it should read 96.875%.

  3. #3
    TS Contributor
    Points: 22,350, Level: 92
    Level completed: 50%, Points required for next Level: 1,000
    spunky's Avatar
    Location
    vancouver, canada
    Posts
    2,135
    Thanks
    166
    Thanked 537 Times in 431 Posts

    Re: 2012 Presidential Election Probability Calculator


    well... there seems to be quite a few things going on here but i will limit my 2 cents of (constructive) criticism to something that, although very simple, it's EXTREMELY important: from what i gather, you seem to be treating the probability of democrats winning /losing in each state as independent events when they clearly are not. for example, say that in WA the probability of democrats winning is 50% and in OR it is, i dunno, another 50%... the P(Democrats winning | Winning in WA, Winning in OR) is NOT .5 * .5... i dont see how to make the case on statistical (and even on common-sense) grounds that P(Democrats winning | Winning in WA) is independent of P(Democrats winning | Winning in OR)

+ Reply to Thread

           




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats