nyt-2020-election-scraper icon indicating copy to clipboard operation
nyt-2020-election-scraper copied to clipboard

Hurdle is off when greater than 100%

Open DryHeatAz opened this issue 3 years ago • 1 comments

(NOTE: This is not about the previous issues with calculating the hurdle; it's about an edge case.)

Pennsylvania currently shows Biden ahead by 54,273 with 7,914 votes remaining to be counted. Hurdle is 397.3%.

But if Trump got 397.3% of the remaining vote Biden's lead would still be over 20,000 votes. Trump needs 685.8%.

This is a quibble, but it might be worthwhile to figure out why this is happening.

This is a fantastic project and I hope it is available in 2024. It's the clearest way to see what is really happening.

DryHeatAz avatar Nov 12 '20 22:11 DryHeatAz

DryHeatAz is exactly right. The "hurdle" calculation below from the repository is only valid when  votes_remaining_relevant > vote_diff.

The reason is that the hurdle percentage calculation assumes that the person behind will get the hurdle percentage and that the person ahead will still get 1-hurdle percentage, even when hurdle percentage is > 100%.

    votes_remaining_relevant = votes_remaining * latest_relevant_proportion
    hurdle = (vote_diff + votes_remaining_relevant) / (2 * votes_remaining_relevant) if votes_remaining_relevant > 0 else 0

Lines 349-350 in "print-battleground-state-changes" (a python file) https://github.com/alex/nyt-2020-election-scraper/blob/master/print-battleground-state-changes

As long as we are showing hurdle rates > 100%, the calculation probably should be:

    votes_remaining_relevant = votes_remaining * latest_relevant_proportion
    if vote_diff < votes_remaining_relevant:
        hurdle = (vote_diff + votes_remaining_relevant) / (2 * votes_remaining_relevant) if votes_remaining_relevant > 0 else 0
    else: # assume no change in votes for the leader, all remaining go to the person behind
        hurdle = (vote_diff/votes_remaining_relevant) if votes_remaining_relevant > 0 else 0 

pleiby avatar Nov 13 '20 04:11 pleiby