Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hurdle is off when greater than 100% #384

Open
DryHeatAz opened this issue Nov 12, 2020 · 1 comment
Open

Hurdle is off when greater than 100% #384

DryHeatAz opened this issue Nov 12, 2020 · 1 comment

Comments

@DryHeatAz
Copy link

DryHeatAz commented Nov 12, 2020

(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.

@pleiby
Copy link

pleiby commented Nov 13, 2020

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 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants