Skip to content

Commit

Permalink
polling through end August
Browse files Browse the repository at this point in the history
  • Loading branch information
technocrat committed Sep 11, 2024
1 parent 591784d commit ea68dbd
Show file tree
Hide file tree
Showing 43 changed files with 444 additions and 102 deletions.
20 changes: 6 additions & 14 deletions 12th.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,19 @@ title = "Twelfth Amendment"
tags = ["tag1", "tag2"]
+++

## Tie scenario
## Tie scenarios

If **Vice President Harris wins only Pennsylvania, Michigan and Wisconsin** the outcome will be a 269-269 tie in the Electoral College. This assumes that Harris does not win Georgia, North Carolina, Arizona or Nevada, each of which Trump wins. Otherwise, every remaining state is won by the candidate who won it in 2020.
**Vice President Harris ties in three scenarios**, and the outcome will be a 269-269 tie in the Electoral College. This assumes that Harris does not win any other swing state, each of which Trump wins. Otherwise, every remaining state is won by the party that won it in 2020.

* NV, WI, AZ and GA
* NV, WI, AZ and NC
* AZ, GA and NC

## Without the Nebraska Second

The models assume that except for the seven swing states, each candidate will win the states and election districts won in 2020. For Harris, the total includes a Nebraska
district that centers on Omaha. Nebraska is one of two states that have this arrangement. The other is Maine. An attempt was made earlier this year to change Nebraska to the winner-take-all system used by other states. It was unsuccessful, and it is not clear if another attempt will be made. It could be added to a special session anticipated for July to deal with property tax relief, but as of mid-June there has been a scarcity of news raising this. There also appears to be some internecine conflict going on between the Congressional delegation and the MAGA-aligned party apparatus. Should winner take all be implemented or if the Nebraska Second this time votes for Trump, possible outcomes differ.

A tie outcome that was produced by Harris winning only Wisconsin, Michigan and Pennsylvania, now has three different possible scenarios

* Wisconsin, Georgia and Pennsylvania
* Wisconsin, Pennsylvania and North Carolina (through May, NC is not moving in Harris's direction)
* Arizona, Michigan and Pennsylvania

Those three scenarios, which were formally wins, are replaced as the smallest possible victories by

* Nevada, Wisconsin, Arizona and Pennsylvania
* Arizona, Georgia and Pennsylvania
* Arizona, Pennsylvania and North Carolina

## Constitutional framework for a tied vote

> The person having the greatest number of votes for President, shall be the President, if such number be a majority of the whole number of Electors appointed; and if no person have such majority, then from the persons having the highest numbers not exceeding three on the list of those voted for as President, the House of Representatives shall choose immediately, by ballot, the President. But in choosing the President, the **votes shall be taken by states, the representation from each state having one vote**; a quorum for this purpose shall consist of a member or members from two-thirds of the states, and **a majority of all the states shall be necessary to a choice**.
Expand Down
Binary file modified _assets/img/models/AZ_aug1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/img/models/AZ_aug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _assets/img/models/AZ_jul2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/img/models/GA_aug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/img/models/MI_aug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _assets/img/models/NC_aug1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/img/models/NC_aug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/img/models/NV_aug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/img/models/PA_aug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _assets/img/models/WI_aug2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _assets/objs/AZ_aug1_p_sample.bson
Binary file not shown.
Binary file added _assets/objs/AZ_aug2_p_sample.bson
Binary file not shown.
Binary file modified _assets/objs/AZ_jul2_p_sample.bson
Binary file not shown.
Binary file added _assets/objs/GA_aug2_p_sample.bson
Binary file not shown.
Binary file added _assets/objs/MI_aug2_p_sample.bson
Binary file not shown.
Binary file modified _assets/objs/NC_aug1_p_sample.bson
Binary file not shown.
Binary file added _assets/objs/NC_aug2_p_sample.bson
Binary file not shown.
Binary file added _assets/objs/NV_aug2_p_sample.bson
Binary file not shown.
Binary file added _assets/objs/PA_aug2_p_sample.bson
Binary file not shown.
Binary file added _assets/objs/WI_aug2_p_sample.bson
Binary file not shown.
Binary file modified _assets/objs/aug1_polls.bson
Binary file not shown.
Binary file added _assets/objs/aug2_polls.bson
Binary file not shown.
Binary file added _assets/objs/aug_polls.bson
Binary file not shown.
Binary file modified _assets/objs/jul2_polls.bson
Binary file not shown.
6 changes: 3 additions & 3 deletions _assets/scripts/commons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct Poll
end
#------------------------------------------------------------------
"""
filter_empty_entries(dict::Dict{Pollster, Vector{Poll}}) -> Dict{Pollster, Vector{Poll}}
remove_empty_entries(dict::Dict{Pollster, Vector{Poll}}) -> Dict{Pollster, Vector{Poll}}
Filter out entries in a dictionary where the values are empty vectors.
Expand All @@ -87,7 +87,7 @@ Filter out entries in a dictionary where the values are empty vectors.
- `Dict{Pollster, Vector{Poll}}`: A new dictionary containing only the entries from the input dictionary where the vectors are not empty.
# Description
The `filter_empty_entries` function iterates over each key-value pair in the provided dictionary. It constructs a new dictionary that includes only those entries where the value (a vector of `Poll` objects) is not empty.
The `remove_empty_entries` function iterates over each key-value pair in the provided dictionary. It constructs a new dictionary that includes only those entries where the value (a vector of `Poll` objects) is not empty.
# Example
```julia
Expand All @@ -113,7 +113,7 @@ dict = Dict(
)
# Filter out entries with empty vectors
filtered_dict = filter_empty_entries(dict)
filtered_dict = remove_entries(dict)
println(filtered_dict)
# Output:
# Dict{Pollster, Vector{Poll}} with 1 entry:
Expand Down
Binary file added _assets/scripts/generico_concentration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion _assets/scripts/insert_aug1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ months[aug1][WI][tr] = [Poll(48,49,800)]


# needs to be done manually rather than with include()
#@save "../objs/aug1_polls.bson" months
@save "../objs/aug1_polls.bson" months


112 changes: 112 additions & 0 deletions _assets/scripts/insert_aug2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
using BSON: @save, @load
using CSV
using DataFrames
using LinearAlgebra
using PrettyTables
using Printf
using Serialization
using Statistics
using StatsPlots
using Turing

@enum Month mar apr may jul jul2 aug1 aug2 sep oct nov

@enum Pollster begin
ag
aj
am
bi2
bi3
bl2
bl3
cb2
cb3
cj
cn2
cn3
ea
ec2
ec3
ep
eu
fm2
fm3
fo2
fo3
hi2
hi3
hp
ia
ma2
ma3
mi2
mi3
mq
mr2
mr3
ny2
ns
pp
ny
qi2
qi3
rr
si2
si3
sp2
sp3
su2
su3
tr
wa2
wa3
ws
wsl
wss
yg
end

@enum State PA GA NC MI AZ WI NV

struct Poll
harris_support::Float64
trump_support::Float64
sample_size::Int64
end


@load "../objs/aug1_polls.bson" months

months[aug2][AZ][bl2] = [Poll(48,48,805)]
months[aug2][AZ][ec2] = [Poll(47,50,720)]
months[aug2][AZ][fo2] = [Poll(50,49,1014)]
months[aug2][AZ][ia] = [Poll(48,49,800)]
months[aug2][AZ][cn2] = [Poll(44,49,800)]
months[aug2][GA][bl2] = [Poll(49,47,801)]
months[aug2][GA][ec2] = [Poll(49,48,800)]
months[aug2][GA][fo2] = [Poll(49,49,1014)]
months[aug2][GA][ia] = [Poll(48,48,800)]
months[aug2][MI][bl2] = [Poll(49,46,702)]
months[aug2][MI][ec2] = [Poll(50,47,800)]
months[aug2][MI][ep] = [Poll(44,44,600)]
months[aug2][MI][tr] = [Poll(47,47,1089)]
months[aug2][NC][bl2] = [Poll(50,45,803)]
months[aug2][NC][ec2] = [Poll(48,49,775)]
months[aug2][NC][eu] = [Poll(47,48,720)]
months[aug2][NC][fo2] = [Poll(49,50,999)]
months[aug2][NC][ia] = [Poll(48,49,800)]
months[aug2][NV][bl2] = [Poll(49,45,700)]
months[aug2][NV][ec2] = [Poll(49,48,1168)]
months[aug2][NV][fo2] = [Poll(50,48,1026)]
months[aug2][NV][ia] = [Poll(47,48,800)]
months[aug2][PA][bl2] = [Poll(51,47,803)]
months[aug2][PA][ec2] = [Poll(48,48,950)]
months[aug2][PA][tr] = [Poll(45,47,1087)]
months[aug2][WI][tr] = [Poll(46,47,1083)]



# needs to be done manually rather than with include()
#@save "../objs/aug2_polls.bson" months # comes out empty


5 changes: 2 additions & 3 deletions _assets/scripts/insert_jul2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using Statistics
using StatsPlots
using Turing

@enum Month mar apr may jul jul2 aug sep oct nov
@enum Month mar apr may jul jul2 aug1 aug2 sep oct nov

@enum Pollster begin
ag
Expand Down Expand Up @@ -92,8 +92,7 @@ months[jul2][WI][bl2] = [Poll(49,47,700)]
months[jul2][WI][ec2] = [Poll(47,47,854)]
months[jul2][WI][fo2] = [Poll(46,46,1046)]


# needs to be done manually rather than with include()
#@save "../objs/jul2_polls.bson" months
@save "../objs/jul2_polls.bson" months


22 changes: 11 additions & 11 deletions _assets/scripts/polls.jl
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# @enum State PA GA NC MI AZ WI NV
# @enum Month mar apr may jun jul jul2 aug1 aug2 sep oct
#@enum State PA GA NC MI AZ WI NV
#@enum Month mar apr may jun jul jul2 aug1 aug2 sep oct


STATE = State
prior_month = "jul2"
mon = aug1
MON = "aug1"
Mon = "aug1"
st = "NC"
ST = NC
prior_month = "aug1"
mon = aug2
MON = "aug2"
Mon = "aug2"
st = "PA"
ST = PA

#include("polls_head.jl")
# include("polls_head.jl")
prior_poll = BSON.load("../objs/"*"$st"*"_"*"$prior_month"*"_p_sample.bson")
@load "../objs/"*"$MON"*"_polls.bson" months
#@load "../objs/"*"$MON"*"_polls.bson" months # comes up empty
margin = first(margins[margins.st .== st, :pct])

current_month = remove_empties(months[mon])
#
# include("polls_foot.jl")
include("polls_foot.jl")


11 changes: 8 additions & 3 deletions _assets/scripts/polls_foot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ poll_posterior = prior_poll
posterior_mean = mean(poll_posterior[:deep][:p])
posterior_var = var(poll_posterior[:deep][:p])
prior_alpha = posterior_mean *
(posterior_mean * (1 - posterior_mean) / posterior_var - 1)
prior_beta = (1 - posterior_mean) * (posterior_mean *
(1 - posterior_mean) / posterior_var - 1)
(posterior_mean *
(1 - posterior_mean) /
posterior_var - 1)
prior_beta = (1 - posterior_mean) *
(posterior_mean *
(1 - posterior_mean) /
posterior_var - 1)

prior_dist = Beta(prior_alpha, prior_beta)

model = poll_model(num_votes, num_wins, prior_dist)
Expand Down
6 changes: 3 additions & 3 deletions _assets/scripts/polls_head.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mutable struct MetaFrame
end
#------------------------------------------------------------------
struct Poll
biden_support::Float64
harris_support::Float64
trump_support::Float64
sample_size::Int64
end
Expand All @@ -117,7 +117,7 @@ margins = CSV.read("../objs/margins.csv", DataFrame)
margin = first(margins[margins.st .== st, :pct])
#------------------------------------------------------------------
"""
filter_empty_entries(dict::Dict{Pollster, Vector{Poll}}) -> Dict{Pollster, Vector{Poll}}
filter_empty_entries(dict::Dict{Pollster, Vector{Poll}}) -> Dict{Pollster, Vector{Poll}}
Filter out entries in a dictionary where the values are empty vectors.
Expand Down Expand Up @@ -166,7 +166,7 @@ function remove_empties(the_month::Dict)
end
#------------------------------------------------------------------
function process_polls(polls::Vector{Poll})
result = Int64.(collect(collect([(p.biden_support, p.sample_size) for p in polls])[1]))
result = Int64.(collect(collect([(p.harris_support, p.sample_size) for p in polls])[1]))
return [Int64(floor(result[1] / 100 * result[2])), result[2]]
end
#------------------------------------------------------------------
Expand Down
44 changes: 39 additions & 5 deletions az.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Assessments are based on three criteria.
* **Historical**—fewer than 2.5% of the values in the credible interval are less than 2020 margin.
* **Relaxed**—fewer than 2.5% of the values in the credible interval are less than 50.01% of the two candidate vote.

## August assessment before convention

## August assessment after convention

Harris wins under the *Relaxed* criterion.

Expand All @@ -36,13 +37,46 @@ Harris wins under the *Relaxed* criterion.
</thead>
<tbody>
<tr>
<td style = "text-align: right;">0.5012</td>
<td style = "text-align: right;">0.5012</td>
<td style = "text-align: right;">0.5013</td>
<td style = "text-align: right;">0.5013</td>
<td style = "text-align: right;">0.5007</td>
<td style = "text-align: right;">0.5017</td>
<td style = "text-align: right;">0.0</td>
<td style = "text-align: right;">1.0024</td>
</tr>
</tbody>
</table>
<img src="/assets/img/models/AZ_aug2.png" style="width: 100%; display: block;">
~~~
## August assessment before convention

Harris wins under the *Relaxed* criterion.

~~~
<table>
<thead>
<tr class = "header headerLastRow">
<th style = "text-align: right;">median</th>
<th style = "text-align: right;">mean</th>
<th style = "text-align: right;">mode</th>
<th style = "text-align: right;">q025</th>
<th style = "text-align: right;">q975</th>
<th style = "text-align: right;">mcse</th>
<th style = "text-align: right;">rhat</th>
</tr>
</thead>
<tbody>
<tr>
<td style = "text-align: right;">0.5012</td>
<td style = "text-align: right;">0.5012</td>
<td style = "text-align: right;">0.5012</td>
<td style = "text-align: right;">0.5007</td>
<td style = "text-align: right;">0.5018</td>
<td style = "text-align: right;">0.0</td>
<td style = "text-align: right;">1.0001</td>
<td style = "text-align: right;">1.0</td>
</tr>
</tbody>
</table>
Expand All @@ -69,11 +103,11 @@ Harris wins under the *Relaxed* criterion.
<tr>
<td style = "text-align: right;">0.5013</td>
<td style = "text-align: right;">0.5013</td>
<td style = "text-align: right;">0.5013</td>
<td style = "text-align: right;">0.5012</td>
<td style = "text-align: right;">0.5007</td>
<td style = "text-align: right;">0.5018</td>
<td style = "text-align: right;">0.0</td>
<td style = "text-align: right;">1.0004</td>
<td style = "text-align: right;">1.0</td>
</tr>
</tbody>
</table>
Expand Down
33 changes: 33 additions & 0 deletions ga.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,39 @@ Assessments are based on three criteria.
* **Historical**—fewer than 2.5% of the values in the credible interval are less than 2020 margin.
* **Relaxed**—fewer than 2.5% of the values in the credible interval are less than 50.01% of the two candidate vote.

## August assessment after convention

Harris wins under the *Relaxed* criterion.

~~~
<table>
<thead>
<tr class = "header headerLastRow">
<th style = "text-align: right;">median</th>
<th style = "text-align: right;">mean</th>
<th style = "text-align: right;">mode</th>
<th style = "text-align: right;">q025</th>
<th style = "text-align: right;">q975</th>
<th style = "text-align: right;">mcse</th>
<th style = "text-align: right;">rhat</th>
</tr>
</thead>
<tbody>
<tr>
<td style = "text-align: right;">0.5009</td>
<td style = "text-align: right;">0.5009</td>
<td style = "text-align: right;">0.5009</td>
<td style = "text-align: right;">0.5005</td>
<td style = "text-align: right;">0.5014</td>
<td style = "text-align: right;">0.0</td>
<td style = "text-align: right;">1.0</td>
</tr>
</tbody>
</table>
<img src="/assets/img/models/GA_aug2.png" style="width: 100%; display: block;">
~~~

## August assessment before convention

Harris wins under the *Relaxed* criterion.
Expand Down
Loading

0 comments on commit ea68dbd

Please sign in to comment.