diff --git a/_assets/img/models/AZ_aug1.png b/_assets/img/models/AZ_aug1.png index 4614583..b844615 100644 Binary files a/_assets/img/models/AZ_aug1.png and b/_assets/img/models/AZ_aug1.png differ diff --git a/_assets/img/models/AZ_aug2.png b/_assets/img/models/AZ_aug2.png index 03cf533..fb6cfa5 100644 Binary files a/_assets/img/models/AZ_aug2.png and b/_assets/img/models/AZ_aug2.png differ diff --git a/_assets/img/models/AZ_sep1.png b/_assets/img/models/AZ_sep1.png new file mode 100644 index 0000000..3e2ff1c Binary files /dev/null and b/_assets/img/models/AZ_sep1.png differ diff --git a/_assets/img/models/GA_aug1.png b/_assets/img/models/GA_aug1.png index b83ff9f..256593b 100644 Binary files a/_assets/img/models/GA_aug1.png and b/_assets/img/models/GA_aug1.png differ diff --git a/_assets/img/models/GA_aug2.png b/_assets/img/models/GA_aug2.png index a8a114f..4c50748 100644 Binary files a/_assets/img/models/GA_aug2.png and b/_assets/img/models/GA_aug2.png differ diff --git a/_assets/img/models/GA_sep1.png b/_assets/img/models/GA_sep1.png new file mode 100644 index 0000000..79ede78 Binary files /dev/null and b/_assets/img/models/GA_sep1.png differ diff --git a/_assets/img/models/MI_aug1.png b/_assets/img/models/MI_aug1.png index a556c8d..0db74ab 100644 Binary files a/_assets/img/models/MI_aug1.png and b/_assets/img/models/MI_aug1.png differ diff --git a/_assets/img/models/MI_aug2.png b/_assets/img/models/MI_aug2.png index bc1b9b7..327f350 100644 Binary files a/_assets/img/models/MI_aug2.png and b/_assets/img/models/MI_aug2.png differ diff --git a/_assets/img/models/NC_aug1.png b/_assets/img/models/NC_aug1.png index d9f8706..4028194 100644 Binary files a/_assets/img/models/NC_aug1.png and b/_assets/img/models/NC_aug1.png differ diff --git a/_assets/img/models/NC_aug2.png b/_assets/img/models/NC_aug2.png index 3da5ebf..cb210db 100644 Binary files a/_assets/img/models/NC_aug2.png and b/_assets/img/models/NC_aug2.png differ diff --git a/_assets/img/models/NC_sep1.png b/_assets/img/models/NC_sep1.png new file mode 100644 index 0000000..1390a57 Binary files /dev/null and b/_assets/img/models/NC_sep1.png differ diff --git a/_assets/img/models/NV_aug1.png b/_assets/img/models/NV_aug1.png index ca4d3b6..78d3410 100644 Binary files a/_assets/img/models/NV_aug1.png and b/_assets/img/models/NV_aug1.png differ diff --git a/_assets/img/models/NV_aug2.png b/_assets/img/models/NV_aug2.png index 8630f3f..c9776df 100644 Binary files a/_assets/img/models/NV_aug2.png and b/_assets/img/models/NV_aug2.png differ diff --git a/_assets/img/models/NV_sep1.png b/_assets/img/models/NV_sep1.png new file mode 100644 index 0000000..8f44e7e Binary files /dev/null and b/_assets/img/models/NV_sep1.png differ diff --git a/_assets/img/models/PA_aug1.png b/_assets/img/models/PA_aug1.png index 6d92f3b..bf89b96 100644 Binary files a/_assets/img/models/PA_aug1.png and b/_assets/img/models/PA_aug1.png differ diff --git a/_assets/img/models/PA_aug2.png b/_assets/img/models/PA_aug2.png index 49a7722..fc4804a 100644 Binary files a/_assets/img/models/PA_aug2.png and b/_assets/img/models/PA_aug2.png differ diff --git a/_assets/img/models/PA_sep1.png b/_assets/img/models/PA_sep1.png new file mode 100644 index 0000000..c15a544 Binary files /dev/null and b/_assets/img/models/PA_sep1.png differ diff --git a/_assets/img/models/WI_aug1.png b/_assets/img/models/WI_aug1.png index 458289a..542ae8b 100644 Binary files a/_assets/img/models/WI_aug1.png and b/_assets/img/models/WI_aug1.png differ diff --git a/_assets/img/models/WI_aug2.png b/_assets/img/models/WI_aug2.png index 6d95442..4314dbc 100644 Binary files a/_assets/img/models/WI_aug2.png and b/_assets/img/models/WI_aug2.png differ diff --git a/_assets/img/models/WI_sep1.png b/_assets/img/models/WI_sep1.png new file mode 100644 index 0000000..b1a138d Binary files /dev/null and b/_assets/img/models/WI_sep1.png differ diff --git a/_assets/img/models/mi_sep1.png b/_assets/img/models/mi_sep1.png new file mode 100644 index 0000000..79ede78 Binary files /dev/null and b/_assets/img/models/mi_sep1.png differ diff --git a/_assets/objs/AZ_aug1_p_sample.bson b/_assets/objs/AZ_aug1_p_sample.bson index 51e8de5..f3e8ca8 100644 Binary files a/_assets/objs/AZ_aug1_p_sample.bson and b/_assets/objs/AZ_aug1_p_sample.bson differ diff --git a/_assets/objs/AZ_aug2_p_sample.bson b/_assets/objs/AZ_aug2_p_sample.bson index 2fb704a..d71b10c 100644 Binary files a/_assets/objs/AZ_aug2_p_sample.bson and b/_assets/objs/AZ_aug2_p_sample.bson differ diff --git a/_assets/objs/AZ_sep1_p_sample.bson b/_assets/objs/AZ_sep1_p_sample.bson new file mode 100644 index 0000000..9110de0 Binary files /dev/null and b/_assets/objs/AZ_sep1_p_sample.bson differ diff --git a/_assets/objs/GA_aug1_p_sample.bson b/_assets/objs/GA_aug1_p_sample.bson index d7777ce..79192cf 100644 Binary files a/_assets/objs/GA_aug1_p_sample.bson and b/_assets/objs/GA_aug1_p_sample.bson differ diff --git a/_assets/objs/GA_aug2_p_sample.bson b/_assets/objs/GA_aug2_p_sample.bson index 853832b..1276d90 100644 Binary files a/_assets/objs/GA_aug2_p_sample.bson and b/_assets/objs/GA_aug2_p_sample.bson differ diff --git a/_assets/objs/GA_sep1_p_sample.bson b/_assets/objs/GA_sep1_p_sample.bson new file mode 100644 index 0000000..2258590 Binary files /dev/null and b/_assets/objs/GA_sep1_p_sample.bson differ diff --git a/_assets/objs/MI_aug1_p_sample.bson b/_assets/objs/MI_aug1_p_sample.bson index 189a168..dd2ddd9 100644 Binary files a/_assets/objs/MI_aug1_p_sample.bson and b/_assets/objs/MI_aug1_p_sample.bson differ diff --git a/_assets/objs/MI_aug2_p_sample.bson b/_assets/objs/MI_aug2_p_sample.bson index 5e0dbe5..1263103 100644 Binary files a/_assets/objs/MI_aug2_p_sample.bson and b/_assets/objs/MI_aug2_p_sample.bson differ diff --git a/_assets/objs/NC_aug1_p_sample.bson b/_assets/objs/NC_aug1_p_sample.bson index cc77079..9c59d6d 100644 Binary files a/_assets/objs/NC_aug1_p_sample.bson and b/_assets/objs/NC_aug1_p_sample.bson differ diff --git a/_assets/objs/NC_aug2_p_sample.bson b/_assets/objs/NC_aug2_p_sample.bson index 36b4096..4ec2ac2 100644 Binary files a/_assets/objs/NC_aug2_p_sample.bson and b/_assets/objs/NC_aug2_p_sample.bson differ diff --git a/_assets/objs/NC_sep1_p_sample.bson b/_assets/objs/NC_sep1_p_sample.bson new file mode 100644 index 0000000..6a16aad Binary files /dev/null and b/_assets/objs/NC_sep1_p_sample.bson differ diff --git a/_assets/objs/NV_aug1_p_sample.bson b/_assets/objs/NV_aug1_p_sample.bson index 3133a1c..605dc09 100644 Binary files a/_assets/objs/NV_aug1_p_sample.bson and b/_assets/objs/NV_aug1_p_sample.bson differ diff --git a/_assets/objs/NV_aug2_p_sample.bson b/_assets/objs/NV_aug2_p_sample.bson index 36af69e..f5975f3 100644 Binary files a/_assets/objs/NV_aug2_p_sample.bson and b/_assets/objs/NV_aug2_p_sample.bson differ diff --git a/_assets/objs/NV_sep1_p_sample.bson b/_assets/objs/NV_sep1_p_sample.bson new file mode 100644 index 0000000..1561606 Binary files /dev/null and b/_assets/objs/NV_sep1_p_sample.bson differ diff --git a/_assets/objs/PA_aug1_p_sample.bson b/_assets/objs/PA_aug1_p_sample.bson index 20295ad..ae767b7 100644 Binary files a/_assets/objs/PA_aug1_p_sample.bson and b/_assets/objs/PA_aug1_p_sample.bson differ diff --git a/_assets/objs/PA_aug2_p_sample.bson b/_assets/objs/PA_aug2_p_sample.bson index 367e7d4..6c8c9bd 100644 Binary files a/_assets/objs/PA_aug2_p_sample.bson and b/_assets/objs/PA_aug2_p_sample.bson differ diff --git a/_assets/objs/PA_sep1_p_sample.bson b/_assets/objs/PA_sep1_p_sample.bson new file mode 100644 index 0000000..f201103 Binary files /dev/null and b/_assets/objs/PA_sep1_p_sample.bson differ diff --git a/_assets/objs/WI_aug1_p_sample.bson b/_assets/objs/WI_aug1_p_sample.bson index 0ee8af0..2ad4551 100644 Binary files a/_assets/objs/WI_aug1_p_sample.bson and b/_assets/objs/WI_aug1_p_sample.bson differ diff --git a/_assets/objs/WI_aug2_p_sample.bson b/_assets/objs/WI_aug2_p_sample.bson index 8e248f2..1e10edd 100644 Binary files a/_assets/objs/WI_aug2_p_sample.bson and b/_assets/objs/WI_aug2_p_sample.bson differ diff --git a/_assets/objs/WI_sep1_p_sample.bson b/_assets/objs/WI_sep1_p_sample.bson new file mode 100644 index 0000000..9836c02 Binary files /dev/null and b/_assets/objs/WI_sep1_p_sample.bson differ diff --git a/_assets/objs/aug1_polls.bson b/_assets/objs/aug1_polls.bson index e553a94..685ca2b 100644 Binary files a/_assets/objs/aug1_polls.bson and b/_assets/objs/aug1_polls.bson differ diff --git a/_assets/objs/jul2_polls.bson b/_assets/objs/jul2_polls.bson index 1bd354c..2bceeda 100644 Binary files a/_assets/objs/jul2_polls.bson and b/_assets/objs/jul2_polls.bson differ diff --git a/_assets/objs/mi_sep1_p_sample.bson b/_assets/objs/mi_sep1_p_sample.bson new file mode 100644 index 0000000..2258590 Binary files /dev/null and b/_assets/objs/mi_sep1_p_sample.bson differ diff --git a/_assets/objs/mon_template.bson b/_assets/objs/mon_template.bson new file mode 100644 index 0000000..2bceeda Binary files /dev/null and b/_assets/objs/mon_template.bson differ diff --git a/_assets/objs/AZ_new_prior.bson b/_assets/objs/new_prior.bson similarity index 100% rename from _assets/objs/AZ_new_prior.bson rename to _assets/objs/new_prior.bson diff --git a/_assets/scripts/CreateOutcomes.jl b/_assets/scripts/CreateOutcomes.jl index 5f9211a..1acfee1 100644 --- a/_assets/scripts/CreateOutcomes.jl +++ b/_assets/scripts/CreateOutcomes.jl @@ -55,10 +55,10 @@ outcome = DataFrame( votes = [sum(votes[state] for state in combo) for combos_list in values(combos) for combo in combos_list] ) -outcome.harris = outcome.votes .+ blues -outcome.trump = COLLEGE .- outcome.harris +outcome.harris = outcome.votes .+ blues +outcome.trump = COLLEGE .- outcome.harris outcome.total = outcome.harris .+ outcome.trump -outcome.check = outcome.total .- COLLEGE +outcome.check = outcome.total .- COLLEGE sort!(outcome,:votes) all(outcome.check .== 0) diff --git a/_assets/scripts/cons.jl b/_assets/scripts/cons.jl new file mode 100644 index 0000000..2405bb5 --- /dev/null +++ b/_assets/scripts/cons.jl @@ -0,0 +1,7 @@ +STATE = State +const states = ["NV", "WI", "AZ", "GA", "MI", "PA", "NC"] +const FLAGRED = "rgb(178, 34, 52)" +const FLAGBLUE = "rgb( 60, 59, 110)" +const PURPLE = "rgb(119, 47, 81)" +const GREENBAR = "rgb( 47, 119, 78)" +const LORANGE = "rgb(225, 170, 110)" diff --git a/_assets/scripts/debris/old_az.md b/_assets/scripts/debris/old_az.md new file mode 100644 index 0000000..1f863bd --- /dev/null +++ b/_assets/scripts/debris/old_az.md @@ -0,0 +1,227 @@ +In the 2020 election President Biden won 50.16% (0.5016) of the votes cast for Biden or Trump in Arizona. This leaves out votes for third-party candidates. Taking the actual result as a starting point, the model introduces some uncertainty into the result to create a range of outcomes for that election from 50.10% to 50.21%. Next, the results of each month's polling are factored in on a rolling basis. When the plot shows that more of the credible interval lies to the left of the 2020 margin it indicates that Harris is losing ground compared to the 2020 election results, taking the polls at face value. + +Beginning with polls conducted from July 23 - July 31, 2024, the model that used results through July 22, 2024 plus an allowance for the uncertainty introduced by the entry of Vice President Harris in place of President Biden will be used as the starting point, to be updated fortnightly by later poll results. + +## July assessment from beginning of Harris campaign + +Harris wins under the *Relaxed* criterion. + +~~~ + + + + + + + + + + + + + + + + + + + + + + + +
medianmeanmodeq025q975mcserhat
0.50130.50130.50120.50070.50180.01.0
+ +~~~ + +## July assessment through end of Biden campaign + +Biden wins under the *Relaxed* criterion. + +~~~ + + + + + + + + + + + + + + + + + + + + + + + +
medianmeanmodeq025q975mcserhat
0.50130.50130.50150.50080.50180.01.0
+ + +~~~ + +## June assessment + +Biden wins under the *Relaxed* criterion. + +~~~ + + + + + + + + + + + + + + + + + + + + + + + +
medianmeanmodeq025q975mcserhat
0.50140.50140.50140.50090.50190.01.0008
+ + + ~~~ + +## May assessment + +Biden wins under the *Relaxed* criterion. + +~~~ + + + + + + + + + + + + + + + + + + + + + + + +
medianmeanmodeq025q975mcserhat
0.50140.50140.50150.50090.5020.01.0
+ + + ~~~ +## April assessment + +Biden wins under the *Relaxed* criterion. +~~~ + + + + + + + + + + + + + + + + + + + + + + +
medianmeanmodeq025q975mcserhat
0.50150.50150.50130.50090.5020.01.0008
+ + +~~~ +## March assessment +Biden wins under the *Relaxed* criterion. + + +~~~ + + + + + + + + + + + + + + + + + + + + + + + +
medianmeanmodeq025q975mcserhat
0.50150.50150.50140.5010.50210.01.0001 +
+ +~~~ + +## 2020 election + +~~~ + + + + + + + + + + + + + + + + + + + + + + + +
medianmeanmodeq025q975mcserhat
0.50160.50160.50160.5010.50210.01.0002
+ +~~~ diff --git a/_assets/scripts/dict.jl b/_assets/scripts/dict.jl new file mode 100644 index 0000000..1063fc7 --- /dev/null +++ b/_assets/scripts/dict.jl @@ -0,0 +1,14 @@ +Month_names = Dict( + "mar" => "March", + "apr" => "April", + "may" => "May", + "jun" => "June", + "jul" => "July", + "jul2" => "July-post", + "aug1" => "early August", + "aug2" => "late August", + "sep1" => "early September", + "sep3" => "late September", + "oct1" => "early October", + "oct2" => "late October", + "fin" => "final polling") diff --git a/_assets/scripts/enum.jl b/_assets/scripts/enum.jl new file mode 100644 index 0000000..ccb1038 --- /dev/null +++ b/_assets/scripts/enum.jl @@ -0,0 +1,59 @@ +@enum Month mar apr may jul jul2 aug1 aug2 sep1 sep2 oct1 oct2 nov fin +@enum Pollster begin + ag + aj + am + bi2 + bi3 + bl2 + bl3 + cb2 + cb3 + cj + cn2 + cn3 + ea + ec2 + ec3 + ep + eu + fa + 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 + us + wa2 + wa3 + wr + ws + wsl + wss + yg +end +@enum State PA GA NC MI AZ WI NV diff --git a/_assets/scripts/func.jl b/_assets/scripts/func.jl new file mode 100644 index 0000000..e82bbaa --- /dev/null +++ b/_assets/scripts/func.jl @@ -0,0 +1,88 @@ +#------------------------------------------------------------------ +function remove_empties(the_month::Dict) + Dict(state => Dict(pollster => polls for (pollster, polls) in pollsters + if !isempty(polls)) for (state, pollsters) in the_month) +end +#------------------------------------------------------------------ +function process_polls(polls::Vector{Poll}) + 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 +#------------------------------------------------------------------ +function draw_density() + # Create a new figure with specified resolution + fig = Figure(size = (600, 400)) + + # Add an axis to the figure + ax = Axis(fig[1, 1], xlabel = "Likelihood of Harris win", ylabel = "Number of draws", title = "Model: Harris results in $ST with polling through " * Month_names[Mon]) + + # Plot the full density curve + lines!(ax, kde_result.x, kde_result.density, color = "#a3b35c", linewidth = 3, strokewidth = 4, strokecolor = GREENBAR, label = "Draws") + + # Find the indices corresponding to the posterior interval + indices = findall((posterior_interval[1] .<= kde_result.x) .& (kde_result.x .<= posterior_interval[2])) + + # Extract the x and y values within the posterior interval + x_region = kde_result.x[indices] + y_region = kde_result.density[indices] + + # Fill the specific area under the curve + band!(ax, x_region, fill(0, length(x_region)), y_region, color = (LORANGE), label = "Credible Interval") + + # Find the y-value corresponding to the specified x-value + y_value = kde_result.density[argmin(abs.(kde_result.x .- margin))] + + # Add a vertical line at the specified x-value from 0 to the y-value + vlines!(ax, [margin], [0, y_value], color = FLAGBLUE, linestyle = :dash, linewidth = 4, label = "2020 Actual") + + # Add a legend to the plot + axislegend(ax) + + # Adjust the plot limits to fit the density line + Makie.xlims!(ax, extrema(p_vec)) + Makie.ylims!(ax, 0, nothing) + + # Display the figure + fig +end +#------------------------------------------------------------------ +function consolidate_polls(current_month) + consolidated = Dict{State, NamedTuple{(:harris_support, :trump_support, :sample_size), Tuple{Float64, Float64, Int64}}}() + for (state, pollsters) in current_month + total_harris = 0.0 + total_trump = 0.0 + total_sample = 0 + for (_, polls) in pollsters + for poll in polls + total_harris += poll.harris_support * poll.sample_size + total_trump += poll.trump_support * poll.sample_size + total_sample += poll.sample_size + end + end + avg_harris = total_harris / total_sample + avg_trump = total_trump / total_sample + consolidated[state] = (harris_support = avg_harris, trump_support = avg_trump, sample_size = total_sample) + end + return consolidated +end + +#------------------------------------------------------------------ +function calculate_support(consolidated_polls, state) + poll_data = consolidated_polls[state] + + harris_votes = floor(Int, poll_data.sample_size * (poll_data.harris_support / 100)) + trump_votes = floor(Int, poll_data.sample_size * (poll_data.trump_support / 100)) + + return ( + harris_votes = harris_votes, + trump_votes = trump_votes, + sample_size = poll_data.sample_size + ) +end +#------------------------------------------------------------------ +@model function poll_model(num_votes::Int64, num_wins::Int64, prior_dist::Distribution) + # Define the prior using the informed prior distribution + p ~ prior_dist + # Define the likelihood with additional uncertainty + num_wins ~ Binomial(num_votes, p) +end \ No newline at end of file diff --git a/_assets/scripts/generico_concentration.png b/_assets/scripts/generico_concentration.png deleted file mode 100644 index 6bd41f6..0000000 Binary files a/_assets/scripts/generico_concentration.png and /dev/null differ diff --git a/_assets/scripts/harris_poll.jl b/_assets/scripts/harris_poll.jl new file mode 100644 index 0000000..16e311f --- /dev/null +++ b/_assets/scripts/harris_poll.jl @@ -0,0 +1,20 @@ +include("libr.jl") # libraries +include("strc.jl") # structures +include("enum.jl") # enumerations +include("impt.jl") # object imports +include("cons.jl") # constants +include("dict.jl") # dictionaries +include("poll.jl") # polling data +include("func.jl") # functions + +prior_month = "aug2" +mon = sep1 +MON = "sep1" +Mon = "sep1" +st = "WI" +ST = WI + +include("main.jl") # modeling +include("outp.jl") # output +include("insp.jl") # check results +include("save.jl") # save model diff --git a/_assets/scripts/impt.jl b/_assets/scripts/impt.jl new file mode 100644 index 0000000..a2803bb --- /dev/null +++ b/_assets/scripts/impt.jl @@ -0,0 +1,3 @@ +margins = CSV.read("../objs/margins.csv", DataFrame) +@load "../objs/mon_template.bson" months +prior_poll = BSON.load("../objs/"*"$st"*"_"*"$prior_month"*"_p_sample.bson") diff --git a/_assets/scripts/insert_aug1.jl b/_assets/scripts/insert_aug1.jl index 158b91a..a9808d0 100644 --- a/_assets/scripts/insert_aug1.jl +++ b/_assets/scripts/insert_aug1.jl @@ -9,7 +9,7 @@ using Statistics using StatsPlots using Turing -@enum Month mar apr may jul jul2 aug1 aug2 sep oct nov +@enum Month mar apr may jul jul2 aug1 aug2 sep1 sep2 oct1 sep2 fin @enum Pollster begin ag diff --git a/_assets/scripts/insert_aug2.jl b/_assets/scripts/insert_aug2.jl index f1ef43d..f5d3a2e 100644 --- a/_assets/scripts/insert_aug2.jl +++ b/_assets/scripts/insert_aug2.jl @@ -9,7 +9,7 @@ using Statistics using StatsPlots using Turing -@enum Month mar apr may jul jul2 aug1 aug2 sep oct nov +@enum Month mar apr may jul jul2 aug1 aug2 sep oct nov last @enum Pollster begin ag diff --git a/_assets/scripts/insert_jul2.jl b/_assets/scripts/insert_jul2.jl index fffd4bc..3205c6e 100644 --- a/_assets/scripts/insert_jul2.jl +++ b/_assets/scripts/insert_jul2.jl @@ -9,7 +9,7 @@ using Statistics using StatsPlots using Turing -@enum Month mar apr may jul jul2 aug1 aug2 sep oct nov +@enum Month mar apr may jul jul2 aug1 aug2 sep1 sep2 oct1 oct2 nov fin @enum Pollster begin ag diff --git a/_assets/scripts/insp.jl b/_assets/scripts/insp.jl new file mode 100644 index 0000000..3e5b475 --- /dev/null +++ b/_assets/scripts/insp.jl @@ -0,0 +1,4 @@ +#chain +summarystats(chain) +#autocor(chain) +hpd(chain) diff --git a/_assets/scripts/libr.jl b/_assets/scripts/libr.jl index 13d9272..c3ec762 100644 --- a/_assets/scripts/libr.jl +++ b/_assets/scripts/libr.jl @@ -1,9 +1,22 @@ -using CSV -using DataFrames +using BSON +using BSON: @load, @save using Colors using Combinatorics +using CSV +using DataFrames +using Distributions +using Format +using GLMakie using HTTP +using KernelDensity +using LinearAlgebra +using MCMCChains +using Missings using PlotlyJS -using SHA -using SQLite - +using Plots +using PrettyTables +using Printf +using Serialization +using Statistics +using StatsPlots +using Turing \ No newline at end of file diff --git a/_assets/scripts/main.jl b/_assets/scripts/main.jl new file mode 100644 index 0000000..2f10c87 --- /dev/null +++ b/_assets/scripts/main.jl @@ -0,0 +1,43 @@ +current_month = remove_empties(months[mon]) +margin = first(margins[margins.st .== st, :pct]) +consolidated_polls = consolidate_polls(current_month) +support = calculate_support(consolidated_polls,ST) +num_wins = support[1] +num_votes = support[3] +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) +prior_dist = Beta(prior_alpha, prior_beta) +model = poll_model(num_votes, num_wins, prior_dist) +sampler = NUTS(0.65) +num_samples = 10000 +num_chains = 4 +init_params = [Dict(:p => 0.5)] +chain = sample(poll_model(num_votes, num_wins, prior_dist), + sampler, num_samples, init_params=init_params) +p_intv = quantile(chain[:p], [0.025, 0.975]) +p_mean = summarystats(chain)[1,:mean] +p_mcse = summarystats(chain)[1,:mcse] +p_rhat = summarystats(chain)[1,:rhat] +p_df = DataFrame(median = median(chain[:p]), + mean = mean(chain[:p]), + mode = mode(chain[:p]), + min = findmin(chain[:p])[1], + max = findmax(chain[:p])[1], + q025 = p_intv[1], + q975 = p_intv[2]) +out = Vector(p_df[1,:]) +out = round.(out,digits = 4) +p_df[1,:] = out +p_samples = chain[:p] +p_vec = vec(p_samples) +kde_result = kde(p_vec) +posterior_interval = p_intv \ No newline at end of file diff --git a/_assets/scripts/mandelbrot.png b/_assets/scripts/mandelbrot.png deleted file mode 100644 index f1749ca..0000000 Binary files a/_assets/scripts/mandelbrot.png and /dev/null differ diff --git a/_assets/scripts/new_posterior_aftpart.jl b/_assets/scripts/new_posterior_aftpart.jl index 54a8815..97873fe 100644 --- a/_assets/scripts/new_posterior_aftpart.jl +++ b/_assets/scripts/new_posterior_aftpart.jl @@ -27,7 +27,7 @@ function draw_density() fig = Figure(size = (600, 400)) # Add an axis to the figure - ax = Axis(fig[1, 1], xlabel = "Likelihood of Harris win", ylabel = "Number of draws", title = "Model: $ST from beginning assuming an even contest on July 22 before polling") + ax = Axis(fig[1, 1], xlabel = "Likelihood of Harris win", ylabel = "Number of draws", title = "Model: $ST from beginning assumption of an even contest on July 22 before polling") # Plot the full density curve lines!(ax, kde_result.x, kde_result.density, color = "#a3b35c", linewidth = 3, strokewidth = 4, strokecolor = GREENBAR, label = "Draws") diff --git a/_assets/scripts/outp.jl b/_assets/scripts/outp.jl new file mode 100644 index 0000000..76a3662 --- /dev/null +++ b/_assets/scripts/outp.jl @@ -0,0 +1,2 @@ +fig = draw_density() +pretty_table(p_df,backend=Val(:html),show_subheader = false) \ No newline at end of file diff --git a/_assets/scripts/poll.jl b/_assets/scripts/poll.jl new file mode 100644 index 0000000..a876315 --- /dev/null +++ b/_assets/scripts/poll.jl @@ -0,0 +1,93 @@ + + +months[aug1][AZ][ny2] = [Poll(49,45, 677)] +months[aug1][AZ][tr] = [Poll(47,48,1000)] +months[aug1][GA][ny2] = [Poll(44,51, 661)] +months[aug1][MI][tr] = [Poll(49,47, 800)] +months[aug1][NC][cj] = [Poll(44,47, 600)] +months[aug1][NV][ny2] = [Poll(42,45, 677)] +months[aug1][NV][tr] = [Poll(45,49,1000)] +months[aug1][PA][ec2] = [Poll(47,47,1000)] +months[aug1][PA][qi2] = [Poll(48,45,1738)] +months[aug1][PA][tr] = [Poll(44,46,1000)] +months[aug1][WI][tr] = [Poll(48,49, 800)] +months[aug2][AZ][bl2] = [Poll(48,48, 805)] +months[aug2][AZ][cn2] = [Poll(44,49, 800)] +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][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)] +months[jul2][AZ][bl2] = [Poll(48,47, 804)] +months[jul2][AZ][ec2] = [Poll(44,49, 800)] +months[jul2][GA][bl2] = [Poll(47,47, 799)] +months[jul2][GA][ec2] = [Poll(46,48, 800)] +months[jul2][MI][bl2] = [Poll(53,42, 706)] +months[jul2][MI][ec2] = [Poll(45,46, 800)] +months[jul2][MI][fo2] = [Poll(43,45,1012)] +months[jul2][NC][bl2] = [Poll(46,48, 706)] +months[jul2][NV][bl2] = [Poll(47,45, 454)] +months[jul2][PA][am] = [Poll(45,47, 600)] +months[jul2][PA][bl2] = [Poll(46,50, 804)] +months[jul2][PA][ec2] = [Poll(46,48, 850)] +months[jul2][PA][fo2] = [Poll(45,43,1034)] +months[jul2][WI][bl2] = [Poll(49,47, 700)] +months[jul2][WI][ec2] = [Poll(47,47, 854)] +months[jul2][WI][fo2] = [Poll(46,46,1046)] +months[sep1][AZ][ag] = [Poll(48,48,1015)] +months[sep1][AZ][ec2] = [Poll(48,49, 868)] +months[sep1][AZ][tr] = [Poll(46,47,1088)] +months[sep1][GA][ag] = [Poll(48,48, 835)] +months[sep1][GA][aj] = [Poll(44,47,1000)] +months[sep1][GA][ec2] = [Poll(47,50, 975)] +months[sep1][GA][qi2] = [Poll(46,49, 969)] +months[sep1][GA][tr] = [Poll(45,46,1098)] +months[sep1][MI][cb2] = [Poll(50,49,1086)] +months[sep1][MI][ec2] = [Poll(49,47, 875)] +months[sep1][MI][ia] = [Poll(48,49, 580)] +months[sep1][MI][ma2] = [Poll(52,47,1138)] +months[sep1][MI][mi2] = [Poll(48,48, 800)] +months[sep1][MI][qi2] = [Poll(51,46, 905)] +months[sep1][NC][ag] = [Poll(46,49, 973)] +months[sep1][NC][cj] = [Poll(45,46, 600)] +months[sep1][NC][ec2] = [Poll(49,48,1000)] +months[sep1][NC][qi2] = [Poll(50,47, 940)] +months[sep1][NC][tr] = [Poll(46,48,1024)] +months[sep1][NC][wr] = [Poll(49,46, 900)] +months[sep1][NV][ec2] = [Poll(48,48, 895)] +months[sep1][NV][tr] = [Poll(45,44,1079)] +months[sep1][PA][cb2] = [Poll(50,50,1085)] +months[sep1][PA][ec2] = [Poll(47,48, 880)] +months[sep1][PA][fm2] = [Poll(49,46, 890)] +months[sep1][PA][ia] = [Poll(48,50, 875)] +months[sep1][PA][ma2] = [Poll(49,49,1486)] +months[sep1][PA][ny2] = [Poll(50,46,1082)] +months[sep1][PA][qi2] = [Poll(51,46,1331)] +months[sep1][PA][us] = [Poll(49,46, 500)] +months[sep1][PA][wa2] = [Poll(48,48,1003)] +months[sep1][WI][cb2] = [Poll(51,49, 959)] +months[sep1][WI][ec2] = [Poll(49,47, 875)] +months[sep1][WI][fa] = [Poll(49,48, 600)] +months[sep1][WI][ia] = [Poll(49,47, 800)] +months[sep1][WI][ma2] = [Poll(50,49,1194)] +months[sep1][WI][mr2] = [Poll(52,48, 738)] +months[sep1][WI][qi2] = [Poll(51,46, 905)] diff --git a/_assets/scripts/polls.jl b/_assets/scripts/polls.jl index 5ad341a..9279a9b 100644 --- a/_assets/scripts/polls.jl +++ b/_assets/scripts/polls.jl @@ -1,21 +1,109 @@ -#@enum State PA GA NC MI AZ WI NV -#@enum Month mar apr may jun jul jul2 aug1 aug2 sep oct +using BSON: @load, @save +using BSON +using Colors +using Combinatorics +using CSV +using DataFrames +using Distributions +using Format +using HTTP +using GLMakie +using KernelDensity +using LinearAlgebra +using MCMCChains +using Missings +using PlotlyJS +using Plots +using PrettyTables +using Printf +using Serialization +using Statistics +using StatsPlots +using Turing + +# +# struct Poll +# question::String +# response::String +# end + +@enum State PA GA NC MI AZ WI NV +STATE = State +@enum Month mar apr may jun jul jul2 aug1 aug2 sep1 sep2 oct1 oct2 fin +@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 STATE = State -prior_month = "aug2" -mon = hyp -MON = "hyp" -Mon = "hyp" +prior_month = "jul2" +mon = aug1 +MON = "aug1" +Mon = "aug1" st = "AZ" ST = AZ +#@load "../objs/jul_polls.bson" months +margins = CSV.read("../objs/margins.csv", DataFrame) +margin = first(margins[margins.st .== st, :pct]) include("polls_head.jl") -prior_poll = BSON.load("../objs/"*"$st"*"_"*"$prior_month"*"_p_sample.bson") +#prior_poll = BSON.load("../objs/"*"$st"*"_"*"$prior_month"*"_p_sample.bson") +prior_poll = BSON.load("../objs/new_prior.bson") #@load "../objs/"*"$MON"*"_polls.bson" months # comes up empty margin = first(margins[margins.st .== st, :pct]) -current_month = remove_empties(months[mon]) +#current_month = remove_empties(months[mon]) # include("polls_foot.jl") diff --git a/_assets/scripts/polls_foot.jl b/_assets/scripts/polls_foot.jl index 3414949..338fee5 100644 --- a/_assets/scripts/polls_foot.jl +++ b/_assets/scripts/polls_foot.jl @@ -1,28 +1,8 @@ - -@model function poll_model(num_votes::Int64, num_wins::Int64, prior_dist::Distribution) - # Define the prior using the informed prior distribution - p ~ prior_dist - # Define the likelihood with additional uncertainty - num_wins ~ Binomial(num_votes, p) -end - -processed_polls = Dict(state => - Dict(pollster => - process_polls(polls) for (pollster, polls) in pollsters) - for (state, pollsters) in current_month) - -processed_polls_totals = Dict(state => - Dict("num_wins" => - sum(first(values(polls)) for polls in values(pollsters)), - "num_votes" => - sum(last(values(polls)) for polls in values(pollsters))) - for (state, pollsters) in processed_polls) - -num_wins = processed_polls_totals[ST]["num_wins"] -num_votes = processed_polls_totals[ST]["num_votes"] - +consolidated_polls = consolidate_polls(current_month) +support = calculate_support(consolidated_polls,ST) +num_wins = support[1] +num_votes = support[3] poll_posterior = prior_poll - posterior_mean = mean(poll_posterior[:deep][:p]) posterior_var = var(poll_posterior[:deep][:p]) prior_alpha = posterior_mean * @@ -33,9 +13,7 @@ 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) sampler = NUTS(0.65) num_samples = 10000 @@ -43,7 +21,6 @@ num_chains = 4 init_params = [Dict(:p => 0.5)] chain = sample(poll_model(num_votes, num_wins, prior_dist), sampler, num_samples, init_params=init_params) - p_intv = quantile(chain[:p], [0.025, 0.975]) p_mean = summarystats(chain)[1,:mean] p_mcse = summarystats(chain)[1,:mcse] @@ -51,22 +28,18 @@ p_rhat = summarystats(chain)[1,:rhat] p_df = DataFrame(median = median(chain[:p]), mean = mean(chain[:p]), mode = mode(chain[:p]), + min = min(chain[:p]), + max = max(chain[:p]), q025 = p_intv[1], - q975 = p_intv[2], - mcse = summarystats(chain)[1,:mcse], - rhat = summarystats(chain)[1,:rhat]) - + q975 = p_intv[2]), p_samples = chain[:p] p_vec = vec(p_samples) -kde_result = kde(p_vec) - +kde_result = kde(p_vec)\ posterior_interval = p_intv fig = draw_density() save(("../img/models/"*"$st"*"_"*"$mon"*".png"), fig) - deep = deepcopy(chain) @save ("../objs/"*"$st"*"_"*"$mon"*"_p_sample.bson") deep - out = Vector(p_df[1,:]) out = round.(out,digits = 4) p_df[1,:] = out diff --git a/_assets/scripts/polls_head.jl b/_assets/scripts/polls_head.jl index 0fa4bc8..be88fb2 100644 --- a/_assets/scripts/polls_head.jl +++ b/_assets/scripts/polls_head.jl @@ -1,99 +1,10 @@ -using BSON: @load, @save -using BSON -using Colors -using Combinatorics -using CSV -using DataFrames -using Distributions -using Format -using HTTP -using GLMakie -using KernelDensity -using LinearAlgebra -using MCMCChains -using Missings -using PlotlyJS -using Plots -using PrettyTables -using Printf -using Serialization -using Statistics -using StatsPlots -using Turing - - - - -#------------------------------------------------------------------ - - -# @enum State PA GA NC MI AZ WI NV -# STATE = State -@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 - ns - pp - ny2 - qi2 - qi3 - rr - si2 - si3 - sp2 - sp3 - su2 - su3 - tr - wa2 - wa3 - ws - wsl - wss - yg -end -#------------------------------------------------------------------ const states = ["NV", "WI", "AZ", "GA", "MI", "PA", "NC"] const FLAGRED = "rgb(178, 34, 52)" const FLAGBLUE = "rgb( 60, 59, 110)" const PURPLE = "rgb(119, 47, 81)" const GREENBAR = "rgb( 47, 119, 78)" const LORANGE = "rgb(225, 170, 110)" -#------------------------------------------------------------------ -mutable struct MetaFrame - meta::Dict{Symbol, Any} - data::DataFrame -end + #------------------------------------------------------------------ struct Poll harris_support::Float64 @@ -110,12 +21,13 @@ Month_names = Dict( "jul2" => "July-post", "aug1" => "early August", "aug2" => "late August", - "sep" => "September", - "oct" => "October", - "hyp" => "Hypothetical") + "sep1" => "early September", + "sep3" => "late September", + "oct1" => "early October", + "oct2" => "late October", + "fin" => "final polling") #------------------------------------------------------------------ -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}} @@ -138,10 +50,7 @@ struct Pollster name::String end -struct Poll - question::String - response::String -end + # Create a dictionary with some empty and non-empty vectors pollster1 = Pollster("Pollster A") @@ -205,7 +114,7 @@ function draw_density() fig = Figure(size = (600, 400)) # Add an axis to the figure - ax = Axis(fig[1, 1], xlabel = "Likelihood of Harris win", ylabel = "Number of draws", title = "Model: Harris results in $ST from 2020 election and polling through " * Month_names[Mon]) + ax = Axis(fig[1, 1], xlabel = "Likelihood of Harris win", ylabel = "Number of draws", title = "Model: Harris results in $ST with polling through " * Month_names[Mon]) # Plot the full density curve lines!(ax, kde_result.x, kde_result.density, color = "#a3b35c", linewidth = 3, strokewidth = 4, strokecolor = GREENBAR, label = "Draws") @@ -236,4 +145,61 @@ function draw_density() # Display the figure fig end -#------------------------------------------------------------------ \ No newline at end of file +#------------------------------------------------------------------ +@model function poll_model(num_votes::Int64, num_wins::Int64, prior_dist::Distribution) + # Define the prior using the informed prior distribution + p ~ prior_dist + # Define the likelihood with additional uncertainty + num_wins ~ Binomial(num_votes, p) +end + +function consolidate_polls(current_month) + consolidated = Dict{State, NamedTuple{(:harris_support, :trump_support, :sample_size), Tuple{Float64, Float64, Int64}}}() + + for (state, pollsters) in current_month + total_harris = 0.0 + total_trump = 0.0 + total_sample = 0 + + for (_, polls) in pollsters + for poll in polls + total_harris += poll.harris_support * poll.sample_size + total_trump += poll.trump_support * poll.sample_size + total_sample += poll.sample_size + end + end + + avg_harris = total_harris / total_sample + avg_trump = total_trump / total_sample + + consolidated[state] = (harris_support = avg_harris, trump_support = avg_trump, sample_size = total_sample) + end + + return consolidated +end + + poll_data = consolidated_polls[state] + + harris_votes = floor(Int, poll_data.sample_size * (poll_data.harris_support / 100)) + trump_votes = floor(Int, poll_data.sample_size * (poll_data.trump_support / 100)) + + return ( + harris_votes = harris_votes, + trump_votes = trump_votes, + sample_size = poll_data.sample_size + ) +end + +function calculate_support(consolidated_polls, state) + poll_data = consolidated_polls[state] + + harris_votes = floor(Int, poll_data.sample_size * (poll_data.harris_support / 100)) + trump_votes = floor(Int, poll_data.sample_size * (poll_data.trump_support / 100)) + + return ( + harris_votes = harris_votes, + trump_votes = trump_votes, + sample_size = poll_data.sample_size + ) +end + diff --git a/_assets/scripts/reset_prior.jl b/_assets/scripts/reset_prior.jl index d17307a..8934a4d 100644 --- a/_assets/scripts/reset_prior.jl +++ b/_assets/scripts/reset_prior.jl @@ -6,8 +6,8 @@ prior_month = "jul" mon = jul2 MON = "jul2" Mon = "jul2" -st = "NV" -ST = NV +st = "PA" +ST = PA #------------------------------------------------------------------ using BSON: @load, @save using BSON @@ -99,8 +99,12 @@ Month_names = Dict( "jul" => "July", "jul2" => "July-post", "aug" => "August", - "sep" => "September", - "oct" => "October") + "sep1" => "early September", + "sep2" => "late September", + "oct1" => "early October", + "oct2" => "late October", + "fin" => "final polls") + #------------------------------------------------------------------ const states = ["NV", "WI", "AZ", "GA", "MI", "PA", "NC"] const FLAGRED = "rgb(178, 34, 52)" @@ -114,8 +118,8 @@ function draw_density() fig = Figure(size = (600, 400)) # Add an axis to the figure - ax = Axis(fig[1, 1], xlabel = "Likelihood of Harris win", ylabel = "Number of draws", title = "Model: Harris results in $ST from 2020 election and polling through " * Month_names[Mon]) - # Plot the full density curve + ax = Axis(fig[1, 1], xlabel = "Likelihood of Harris win", ylabel = "Number of draws", title = "Model: Harris results in $ST from assumed tie and polling through " * Month_names[Mon]) + # Plot the full density curve lines!(ax, kde_result.x, kde_result.density, color = "#a3b35c", linewidth = 3, strokewidth = 4, strokecolor = GREENBAR, label = "Draws") # Find the indices corresponding to the posterior interval @@ -198,37 +202,6 @@ processed_polls_totals = Dict(state => num_wins = processed_polls_totals[ST]["num_wins"] num_votes = processed_polls_totals[ST]["num_votes"] -#------------------------------------------------------------------ -# Create a kernel density estimate of the prior -# Flatten p_prior to a vector -p_prior_flat = vec(p_prior) - -# Create the new model instance -new_model = updated_model(num_wins, num_votes) - -# Sample from the new model to create an updated posterior -chain = sample(new_model, NUTS(), 10000) - -# Now 'chain' contains your reset posterior, which you can use as a prior for future analyses -#------------------------------------------------------------------ -# 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) -# prior_dist = Beta(prior_alpha, prior_beta) -# -# model = poll_model(num_votes, num_wins, prior_dist) -# sampler = NUTS(0.65) -# num_samples = 10000 -# num_chains = 4 -# init_params = [Dict(:p => 0.5)] -# chain = sample(poll_model(num_votes, num_wins, prior_dist), -# sampler, num_samples, init_params=init_params) - p_intv = quantile(chain[:p], [0.025, 0.975]) p_mean = summarystats(chain)[1,:mean] p_mcse = summarystats(chain)[1,:mcse] @@ -238,8 +211,8 @@ p_df = DataFrame(median = median(chain[:p]), mode = mode(chain[:p]), q025 = p_intv[1], q975 = p_intv[2], - mcse = summarystats(chain)[1,:mcse], - rhat = summarystats(chain)[1,:rhat]) + min = min(chain[:p], + max = max(chain[:p]) p_samples = chain[:p] p_vec = vec(p_samples) diff --git a/_assets/scripts/save.jl b/_assets/scripts/save.jl new file mode 100644 index 0000000..2adca10 --- /dev/null +++ b/_assets/scripts/save.jl @@ -0,0 +1,3 @@ +save(("../img/models/"*"$st"*"_"*"$mon"*".png"), fig) +deep = deepcopy(chain) +@save ("../objs/"*"$st"*"_"*"$mon"*"_p_sample.bson") deep diff --git a/_assets/scripts/strc.jl b/_assets/scripts/strc.jl new file mode 100644 index 0000000..8d1634d --- /dev/null +++ b/_assets/scripts/strc.jl @@ -0,0 +1,5 @@ +struct Poll + harris_support::Float64 + trump_support::Float64 + sample_size::Int64 +end diff --git a/az.md b/az.md index 2073cf0..f686ab5 100644 --- a/az.md +++ b/az.md @@ -7,85 +7,9 @@ title = "Arizona" # Model results -In the 2020 election President Biden won 50.16% (0.5016) of the votes cast for Biden or Trump in Arizona. This leaves out votes for third-party candidates. Taking the actual result as a starting point, the model introduces some uncertainty into the result to create a range of outcomes for that election from 50.10% to 50.21%. Next, the results of each month's polling are factored in on a rolling basis. When the plot shows that more of the credible interval lies to the left of the 2020 margin it indicates that Harris is losing ground compared to the 2020 election results, taking the polls at face value. - -Beginning with polls conducted from July 23 - July 31, 2024, the model that used results through July 22, 2024 plus an allowance for the uncertainty introduced by the entry of Vice President Harris in place of President Biden will be used as the starting point, to be updated fortnightly by later poll results. - -Assessments are based on three criteria. - -* **Stringent**—Harris (after July 22, 2024) or Biden (before July 23, 2024) wins if all of the values in the credible interval (analogous to the confidence interval) are equal to or greater than the 2020 margin of Biden over Trump. -* **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. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50120.50120.50130.50070.50170.01.0024
- - - -~~~ -## August assessment before convention - -Harris wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50120.50120.50120.50070.50180.01.0
- -~~~ -## July assessment from beginning of Harris campaign - -Harris wins under the *Relaxed* criterion. +## Early September assessment +Harris is likely to lose—all of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -93,128 +17,31 @@ Harris wins under the *Relaxed* criterion. + + - - - - - - + + + + - - + +
median mean modeminmax q025 q975mcserhat
0.50130.50130.50120.50070.48360.48360.48360.4673 0.50180.01.00.47420.493
- + ~~~ -## July assessment through end of Biden campaign - -Biden wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50130.50130.50150.50080.50180.01.0
- - -~~~ - -## June assessment - -Biden wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50140.50140.50140.50090.50190.01.0008
- - - ~~~ - -## May assessment - -Biden wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50140.50140.50150.50090.5020.01.0
- +## August assessment after convention - ~~~ -## April assessment +Harris is likely to lose—all of the credible interval is less than 50% of the two-candidate vote. -Biden wins under the *Relaxed* criterion. ~~~ @@ -222,62 +49,30 @@ Biden wins under the *Relaxed* criterion. + + - - - - - - - - - 0.4875 + + + + + +
median mean modeminmax q025 q975mcserhat
0.50150.50150.50130.50090.5020.01.00080.48750.48580.46840.50740.47660.4983
- - -~~~ -## March assessment -Biden wins under the *Relaxed* criterion. - + ~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50150.50150.50140.5010.50210.01.0001 -
- -~~~ - -## 2020 election +## August assessment before convention +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -285,25 +80,25 @@ Biden wins under the *Relaxed* criterion. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.50160.50160.50160.5010.50210.01.00020.49340.49330.49390.46690.52120.480.5064
- + ~~~ ## Scenarios diff --git a/ga.md b/ga.md index ca95ac9..ff76b8a 100644 --- a/ga.md +++ b/ga.md @@ -4,113 +4,11 @@ title = "Georgia" \toc -In the 2020 election President Harris won 50.12% (0.5012) of the Electoral Electoral Electoral Electoral Electoral Votes cast for Harris or Trump in Georgia. This leaves out Electoral Electoral Electoral Electoral Electoral Votes for third-party candidates. Taking the actual Winner as a starting point, the model introduces some uncertainty into the Winner to create a range of outcomes for that election from 50.08% to 50.16%. Next, the Winners of each month's polling are factored in on a rolling basis. When the plot shows that more of the credible interval lies to the left of the 2020 margin it indicates that Harris is losing ground compared to the 2020 election Winners, taking the polls at face value. +# Model results +## Early September assessment -Assessments are based on three criteria. - -* **Stringent**—Harris wins if all of the values in the credible interval (analogous to the confidence interval) are equal to or greater than his 2020 margin. -* **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. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50090.50090.50090.50050.50140.01.0
- - -~~~ - -## August assessment before convention - -Harris wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.5010.5010.5010.50050.50140.00.9999
- - -~~~ -## July assessment from beginning of Harris campaign - -Harris wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.5010.5010.50130.50050.50140.01.0001
- -~~~ - -## July assessment through end of Biden campaign +Harris is likely to lose—all of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -119,63 +17,31 @@ Harris wins under the *Relaxed* criterion. + + - - - - - - - - - + + + + + + + +
median mean modeminmax q025 q975mcserhat
0.5010.5010.50090.50050.50140.01.00010.47680.47690.48030.4610.49380.46820.4854
- - + ~~~ -## June assessment - -Harris win under the *Relaxed* criterion. -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.5010.5010.50110.50060.50150.01.0005
- - - -~~~ -## May assessment +## August assessment after convention -Harris win under the *Relaxed* criterion. +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -184,32 +50,31 @@ Harris win under the *Relaxed* criterion. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.50110.50110.50110.50060.50150.01.00070.49430.49430.49330.47080.51460.4830.5055
- - + ~~~ -## April assessment +## August assessment before convention -Harris win under the *Relaxed* criterion. +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -218,91 +83,29 @@ Harris win under the *Relaxed* criterion. + + - - - - - - - - - - - -
median mean modeminmax q025 q975mcserhat
0.50120.50120.50110.50070.50160.01.0007
- - - -~~~ -## March assessment - -Harris win under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - + + + + + + + - - - - - - - - - -
medianmeanmodeq025q975mcserhat0.49110.49110.48930.46350.51820.47680.5058
0.50110.50110.50110.50070.50160.01.0
- - + ~~~ -## 2020 election -~~~ - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50110.50110.5010.50070.50160.01.0005
- - -~~~ ## Scenarios The scenario tables below show the possible outcomes that involve Georgia. Georgia is represented in 46 of the 128 possible outcomes. *The combinations shown are those representing swing states taken by Harris.* diff --git a/index.md b/index.md index 5a5f456..665ce44 100644 --- a/index.md +++ b/index.md @@ -2,38 +2,13 @@ title = "Latest" +++ -This is the third round of surveys since President Biden withdrew and reflects the following: +Following President Biden's withdrawal in favor of Vice President Harris in July, the previous model's beginning assumptions fell into question. Specifically, the 2020 and 2024 elections no longer have identical opposing candidates. The previous model therefore began with the 2020 results and updated with the polling results. Updating the model with the some random variation to account for the change. However, the polling results during July did not reflect any change from the previous month when Biden was still the candidate. -* The state of the model at July 22, 2024 (the date President Biden) announced his withdrawal was taken as a starting point. This model reflects the following - - The results of the 2020 election (in terms of the percentage won by Biden in the two-candidate tabulation) - - The addition of some random variation to account for the passage of time - - Adjustments based on surveys conducted March-June, 2024 and the July surveys before Biden withdrew -* Into that model more random variation was introduced -* The model was updated based on - - August surveys conducted before the Democratic convention - - August surveys conducted after the Democratic convention - -## Overall assessment for polling through August +As a result, the beginning assumptions were revised to reflect a close contest in the range of Harris taking between 48% and 52% of vote in each swing state. This is a "strong" prior and pronounced polling results will be required to move the credible interval outside that range. The model is based on the *Bayesian analysis* described in [Methodology](/method]). -### Stringent view +## Overall assessment for polling through September 18, 2024 -Based on the criterion that the model must show Harris taking at least 50.25% of the two-candidate split, Harris would win none of the swing states, resulting in **226-312 Electoral College loss.** - -### Historical view - -Based on the criterion that the model shows Harris doing at least as well as Biden did in 2020 in the two-candidate split, Harris would win none of the swing states resulting in a **226-312 Electoral College loss.** - -### Relaxed view - -Based on the criterion that the model shows Harris winning by at least 50% plus one vote of the two-candidate split, Harris would six of the seven swing states (having lost in North Carolina), taking 77 electoral votes resulting in a **303-235 Electoral College victory.** - -The poll results conducted in the seven swing states in March, April, May, June and July (before Biden withdrew) showed presidential preference divided, but favoring Trump in more states than Biden. After Biden withdrew, polling showed Harris generally holding steady in polling through the end of July. In the August pre-convention polls, Harris's nuimbers improved. Each of the poll results has a greater or smaller degree of uncertainty that depends primarily on how many responses were collected. Taking into account, however, the results of 2020, although there were signs of erosion in Biden's support, the performance is better than the standalone polls would suggest. The choice of model is intended to dampen volatility. To date, the results are consistent with an eroding margin in the swing states won by the Democrats in 2020. North Carolina has been static. Although there is a slight model improvement through the end of August, the losing margin in North Carolina has not improved. In the other six swing states, the improvements in polling do not yet reflect the improvements in polling. This is expected. The model describes a close race, possibly closer than 2020. - -The model is based on the *Bayesian analysis* described in [Methodology](/method]) It begins with the relative share of the two-candidate popular vote won by Biden in each of the swing states in 2020 adjusted by the effect of polling conducted to date. - -A total of 44 electoral votes from the swing states is a win, given her safe state edge of 226-219 over Trump. - -The model is **not** a prediction, but only a projection using stated assumptions. Is is only a mathematical representation of the combined information that is derivable from the actual results of millions of voters in those states and the survey responses of hundreds of voters from the same states. Little weight should be given to the likelihoods so far in advance of the election. Beginning with the reports of August polls, expected in early September, political polls historically begin to approximate electoral results. +Harris is likely to lose six of the seven swing states. She is strongest in Wisconsin where not all of the credible interval is below 50%, as it is with the other states. This would result in a 226-312 loss. (225-313 if Nebraska adopts winner take all.) ## Current news diff --git a/method.md b/method.md index a2c2c9b..821e4d4 100644 --- a/method.md +++ b/method.md @@ -4,9 +4,11 @@ title = "Methodology" ## How the likelihood model is made -Among many other facts, one thing is known about the 2020 election in the seven swing states to a high degree of certainty—the [definitive outcomes](https://www.archives.gov/electoral-college/2020) in terms of the votes for the two top candidates and the number of electoral votes awarded. Under the rule of thumb that the future will look similar to the immediate past plus or minus a little, those outcomes provide a *starting* point for further analysis. +At the beginning of the 2024 election season, it was widely thought that the presidential contest would be similar to 2020 with the outcome determined in the states in which the winning margin was very low—less than 1% for PA, GA, MI, PA, NC, AZ, WI—or 2%—Nevada. Polling through mid-July suggested that Trump was pulling into the lead in those states. However, the data was not strong enough to overcome the prior result. The principal effect was to show it would be even closer. -Subject to all the infirmities inherent in political preference polling, the results of swing state specific polling provides additional, provisional information about the 2024 election. The responses of polled voters to questions concrerning the relative level of support enjoyed by the two candidates for any recent period is, at least, some indictor of how the actual outcome should be expected. For this situation we can adjust the results of the 2020 election based on currrent presidential preference primary polling through a process known as **Bayesian modeling**. +When President Biden withdrew in favor of Vice President Harris, it was not clear whether much had changed in the likely outcome other than the influence of 2020 might not be as great since the same two candidates were no longer involved. A reasonable assumption is to model the outcome as a tie to start, updated by new information as it comes along. + +Subject to all the infirmities inherent in political preference polling, the results of swing state specific polling provides additional, provisional information about the 2024 election. The responses of polled voters to questions concrerning the relative level of support enjoyed by the two candidates for any recent period is, at least, some indictor of how the actual outcome should be expected. For this situation we can adjust the results of the prior assumption of an evenly election based on currrent presidential preference primary polling through a process known as **Bayesian modeling**. Here is a short [chatGPT](https://open.ai) summary: @@ -50,10 +52,10 @@ Several types of voters can be considered. * Still politically engaged #### Voters who will vote differently -* Changed view of candidate +* Different Democratic candidate * Different issues came to the fore -#### Voters who will vote the same -* No change in view of candidate +### Voters who will vote the same +* Party loyalty * Different mix of issues in 2024 did not affect choice The main purpose of selecting a Bayesian model for analyzing presidential preference polling in light of actual votes from a swing state in the 2020 election is to effectively incorporate both prior knowledge and new data to update beliefs about the likely outcomes. Bayesian models are particularly suited for this task due to several key features and advantages that align well with the complexities of electoral predictions. diff --git a/mi.md b/mi.md index 4728498..cf1b8dc 100644 --- a/mi.md +++ b/mi.md @@ -6,53 +6,9 @@ title = "Michigan" # Model results -In the 2020 election President Biden won 51.41% (0.5141) of the votes cast for Biden or Trump in Michigan. This leaves out votes for third-party candidates. Taking the actual result as a starting point, the model introduces some uncertainty into the result to create a range of outcomes for that election from 51.36% to 51.45%. Next, the results of each month's polling are factored in on a rolling basis. When the plot shows that more of the credible interval lies to the left of the 2020 margin it indicates that Harris is losing ground compared to the 2020 election results, taking the polls at face value. +## Early September assessment -Beginning with polls conducted from July 23 - July 31, 2024, the model that used results through July 22, 2024 plus an allowance for the uncertainty introduced by the entry of Vice President Harris in place of President Biden will be used as the starting point, to be updated fortnightly by later poll results. - -Assessments are based on three criteria. - -* **Stringent**—Harris wins if all of the values in the credible interval (analogous to the confidence interval) are equal to or greater than his 2020 margin. -* **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. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51380.51380.5140.51340.51420.01.0009
- - -~~~ - - -## August assessment before convention - -Harris wins under the *Relaxed* criterion. +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -61,64 +17,30 @@ Harris wins under the *Relaxed* criterion. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.51390.51390.51360.51340.51430.01.00120.47680.47690.48030.4610.49380.46820.4854
- - + ~~~ +## August assessment after convention - -## July assessment from beginning of Harris campaign - -Harris wins under the *Relaxed criterion* - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51390.51390.51360.51340.51430.01.0
- - -~~~ - -## July assessment through end of Biden campaign +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -127,128 +49,32 @@ Harris wins under the *Relaxed criterion* + + - - - - - - - - - - - - - - - -
median mean modeminmax q025 q975mcserhat
0.51390.51390.51370.51340.51430.01.0011
- - -~~~ -## June assessment - -Biden win under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - + + + + + + +
medianmeanmodeq025q975mcserhat
0.51390.51390.51380.51350.51430.01.00.48950.48950.48970.46690.51150.47770.501
- - -~~~ - -## May assessment - -Biden wins under the *Relaxed* criterion. + -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51390.51390.51390.51350.51440.01.0004
- ~~~ -## April assessment -Biden wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51410.51410.51410.51370.51450.01.0002
- -~~~ - - -## March assessment +## August assessment before convention -Biden wins under the *Relaxed* criterion. +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -257,57 +83,29 @@ Biden wins under the *Relaxed* criterion. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.5140.5140.51410.51360.51450.01.00.49860.49850.49760.47240.52270.48430.5126
- + ~~~ -## 2020 election -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51410.51410.51410.51370.51460.01.0002
- -~~~ ## Scenarios The scenario tables below show the possible outcomes that involve Michigan. Not included is the trivial case where one candidate takes all of the swing states. Michigan is represented in 46 of the 128 possible outcomes. *The combinations shown are those representing swing states taken by Harris.* diff --git a/nc.md b/nc.md index 46e9388..257fec7 100644 --- a/nc.md +++ b/nc.md @@ -5,114 +5,12 @@ title = "North Carolina" \toc -In the 2020 election President Biden won 49.32% (0.4942) of the votes cast for Biden or Trump in North Carolina. This leaves out votes for third-party candidates. Taking the actual result as a starting point, the model introduces some uncertainty into the result to create a range of outcomes for that election from 50.08% to 50.16%. Next, the results of each month's polling is factored in on a rolling basis. When the plot shows that more of the credible interval lies to the left of the 2020 margin it indicates that Harris is losing ground compared to the 2020 election results, taking the polls at face value. +# Model results -Assessments are based on three criteria. +## Early September assessment -* **Stringent**—Harris wins if all of the values in the credible interval (analogous to the confidence interval) are equal to or greater than his 2020 margin. -* **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 - -Trump wins under the *Historical* criterion. -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.4930.4930.4930.49250.49340.01.0
- -~~~ -## August assessment before convention - -Trump wins under the *Historical* criterion. -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.4930.4930.49320.49260.49340.01.0
- - -~~~ -## July assessment from beginning of Harris campaign - -Trump wins under the *Historical* criterion. - - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.4930.4930.49290.49260.49340.01.0
- - -~~~ - -## July assessment through end of Biden campaign - -A Biden victory is not within the credible interval under any of the scenarios. +Harris is likely to lose—all of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -120,125 +18,30 @@ A Biden victory is not within the credible interval under any of the scenarios. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.4930.4930.4930.49260.49340.01.00060.48360.48360.48350.46550.50020.47470.4924
- + ~~~ -## June assessment - -A Biden victory is not within the credible interval under any of the scenarios. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.4930.4930.4930.49260.49340.01.0002
- -~~~ -## May assessment - -A Harris victory is not within the credible interval under any of the scenarios. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.4930.4930.49290.49260.49350.01.0
- -~~~ -## April assessment - -A Biden victory is not within the credible interval under any of the scenarios. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.49320.49320.49330.49270.49360.01.0001
- - -~~~ - -## March assessment +## August assessment after convention -A Biden victory is not within the credible interval under any of the scenarios. +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -246,29 +49,29 @@ A Biden victory is not within the credible interval under any of the scenarios. + + - - + + - - - - - - + + + +
median mean modeminmax q025 q975mcserhat
0.49220.4921 0.49310.49310.49290.49260.49350.01.00040.47280.51160.4810.5028
- - + ~~~ +## August assessment before convention -## 2020 election +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -277,25 +80,26 @@ A Biden victory is not within the credible interval under any of the scenarios. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.49320.49320.49320.49270.49360.00.99990.4920.49210.49640.46190.52160.47750.5066
- + + ~~~ ## Scenarios diff --git a/new_prior.md b/new_prior.md new file mode 100644 index 0000000..10ac23f --- /dev/null +++ b/new_prior.md @@ -0,0 +1,37 @@ +### +Title: Model assumptions +### + +\toc + +# Model assumptions changed + +The model used to track polling in the 2024 presidential election has changed. It was developed in March 2024 when President Biden and former President Trump were the presumptive nominees. The 2020 election was selected for two reasons: + +* The same candidates +* The same swing states in play + +The models showed an erosion of Biden's 2020 winning margins consistent with his lagging performance in polling. + +## Motivation + +The models for July after Biden's withdrawal and in August before and after the Democratic convention showed Harris first stabilizing the erosion from the 2020 results, but the most recent model showed no change at all, despite much improved polling numbers. As a result, the appropriateness of the 2020 election as a starting point fell into question and it was concluded that too great a weight was being given to it and a new initial set of values was needed to better reflect the current situation. + +## Details +### A close race +A broad political consensus still exists that the 2024 election will be very close in the seven swing states that will probably decide the election. The possibilities of breakout by one or the other party are also being discussed, but those are not yet manifest in polling. + +Accordingly, the range of outcomes in the two-candidate margins was set at 0.48-0.52. + +### Strength of prior assumption weakened +Because the election is drawing close, it is expected that polling will become increasingly reflective of the election. For one reason, some people polled may already have cast early ballots. Therefore, an adjustment was made that will allow the initial model to be modified by new polling to a greater degree. + +~~~ + + + + + + + +~~~ \ No newline at end of file diff --git a/nv.md b/nv.md index 7af8353..afd4473 100644 --- a/nv.md +++ b/nv.md @@ -4,115 +4,11 @@ title = "Nevada" \toc -# Model Winners +# Model results -In the 2020 election President Biden won 51.22% (0.5122) of the Electoral Votes cast for Biden or Trump in Nevada. This leaves out Electoral Votes for third-party candidates. Taking the actual Winner as a starting point, the model introduces some uncertainty into the Winner to create a range of outcomes for that election from 51.1% to 51.3%. Next, the Winners of each month's polling are factored in on a rolling basis. When the plot shows that more of the credible interval lies to the left of the 2020 margin it indicates that Harris is losing ground compared to the 2020 election Winners, taking the polls at face value. +## Early September assessment - -Assessments are based on three criteria. - -* **Stringent**—Harris wins if all of the values in the credible interval (analogous to the confidence interval) are equal to or greater than his 2020 margin. -* **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* - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51150.51150.51160.51070.51230.01.0
- -~~~ - - -## August assessment before convention - -Harris wins under the *Relaxed criterion* - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51150.51150.51130.51070.51240.00.9999
- -~~~ -## July assessment from beginning of Harris campaign - -Harris wins under the *Relaxed criterion* - -~~~ - - - - - - - - - - - -__ - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51170.51170.51150.51090.51250.00.9999
- - -~~~ -## July assessment through end of Biden campaign - -Biden wins under the *Relaxed criterion* +Harris is likely to lose—all of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -120,94 +16,31 @@ Biden wins under the *Relaxed criterion* + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.51170.51170.51170.51090.51250.01.00010.48670.48670.48710.46590.50550.47690.4962
- - + ~~~ -## June assessment -Biden wins under the *Relaxed criterion* -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51190.51190.5120.51110.51280.00.9999
- - -~~~ - -## May assessment - -Biden wins under the *Relaxed criterion* -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.5120.5120.51260.51120.51290.01.0
- - -~~~ +## August assessment after convention -## April assessment +Harris is likely to lose—all of the credible interval is less than 50% of the two-candidate vote. -Biden wins under the *Relaxed criterion* ~~~ @@ -215,62 +48,32 @@ Biden wins under the *Relaxed criterion* + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.50310.50310.50320.50260.50370.01.00030.49450.49440.49740.46950.51660.48310.5057
- - + ~~~ -## March assessment -Biden wins under the *Relaxed criterion* +## August assessment before convention -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.51220.51220.5120.51130.5130.01.0
- - -~~~ +Harris is likely to lose—all of credible interval is less than 50% of the two-candidate vote. -## 2020 election ~~~ @@ -278,36 +81,27 @@ Biden wins under the *Relaxed criterion* + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.51220.51220.51210.51140.51310.01.00.49420.49420.49460.47310.51560.48280.5055
- + ~~~ -### [Bloomberg/Morning Consult] (https://pro-assets.morningconsult.com/wp-uploads/2024/03/Bloomberg_2024-Election-Tracking-Wave-6.pdf) - -### [Emerson College](https://docs.google.com/spreadsheets/d/1UHAF-0j9PCycKwiSO75dsrkbn8fFqnkQmGZpC7GzPHg/edit#gid=0) - -### [WSJ](https://s.wsj.net/public/resources/documents/WSJ_Swing_States_Partial_March_2024.pdf) - -## News - -A ballot initiative to amend the state constitution has been [cleared](https://nevadacurrent.com/briefs/abortion-rights-petition-okayed-by-nevada-supreme-court/) by the Nevada Supreme Court. ## Scenarios diff --git a/pa.md b/pa.md index 63a019a..934fd80 100644 --- a/pa.md +++ b/pa.md @@ -7,20 +7,9 @@ title = "Pennsylvania" # Model results -In the 2020 election President Biden won 50.59% (0.5059) of the votes cast for Biden or Trump in Pennsylvania This leaves out votes for third-party candidates. Taking the actual result as a starting point, the model introduces some uncertainty into the result to create a range of outcomes for that election from 50.56% to 50.63%. Next, the results of each month's polling are factored in on a rolling basis. When the plot shows that more of the credible interval lies to the left of the 2020 margin it indicates that Harris is losing ground compared to the 2020 election results, taking the polls at face value. - -Beginning with polls conducted from July 23 - July 31, 2024, the model that used results through July 22, 2024 plus an allowance for the uncertainty introduced by the entry of Vice President Harris in place of President Biden will be used as the starting point, to be updated fortnightly by later poll results. - -Assessments are based on three criteria. - -* **Stringent**—Harris (after July 22, 2024) or Biden (before July 23, 2024) wins if all of the values in the credible interval (analogous to the confidence interval) are equal to or greater than the 2020 margin of Biden over Trump. -* **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. +## Early September assessment +Harris is likely to lose—all of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -28,124 +17,30 @@ Harris wins under the *Relaxed* criterion. + + - - - - - - - - - - - - - -
median mean modeminmax q025 q975mcserhat
0.50560.50560.50560.50530.5060.01.0004
- - -~~~ - -## August assessment before convention - -Harris wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - - - - - - - - + + + + + + +
medianmeanmodeq025q975mcserhat
0.50570.50570.50550.50530.50610.01.00040.49270.49270.49480.47750.50870.4850.5003
- - -~~~ - -## July assessment from beginning of Harris campaign - -Harris wins under the *Relaxed criterion* - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50570.50570.50550.50530.50610.01.0001
- -~~~ - -## July assessment through end of Biden campaign - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50570.50570.50580.50530.50610.01.0
- + ~~~ +## August assessment after convention -## June assessment +Harris is likely to lose—all of the credible interval is less than 50% of the two-candidate vote. -Biden wins under the *Relaxed* criterion ~~~ @@ -153,62 +48,32 @@ Biden wins under the *Relaxed* criterion + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.50580.50580.50580.50540.50610.01.00040.49020.49020.48920.46990.51410.47820.5022
- -~~~ -## May assessment - -Biden wins under the *Relaxed* criterion + ~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50580.50580.50580.50540.50610.01.0001
- -~~~ +## August assessment before convention -## April assessment +Harris is likely to lose—of the credible interval is less than 50% of the two-candidate vote. -Biden wins under the *Relaxed* criterion ~~~ @@ -216,95 +81,27 @@ Biden wins under the *Relaxed* criterion + + - - - - - - - - - - - -
median mean modeminmax q025 q975mcserhat
0.50580.50580.50580.50540.50620.01.0009
- - -~~~ - -## March assessment - -Biden wins under the *Relaxed* criterion. - -~~~ - - - - - - - - - - + + + + + + + - - - - - - - - - - -
medianmeanmodeq025q975mcserhat0.48370.48370.48540.46290.50530.47240.495
0.50580.50580.50570.50540.50620.01.0001
- - -~~~ - -## Model of 2020 election adding uncertainty + ~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50590.50590.50590.50550.50630.01.0004
- -~~~ - - -## Other news - -Pennsylvania's requirement for mail-in ballot envelopes to bear a date survived a [challenge](../mailin) under a federal civil rights law; a claim that it is invalid under the Equal Protection Clause is still pending. ## Scenarios diff --git a/sources.md b/sources.md index 0867b1e..f500f4b 100644 --- a/sources.md +++ b/sources.md @@ -35,104 +35,7 @@ df = CSV.read(IOBuffer(csv_data), DataFrame) ## Polls used[^3] -[Links to original sources were collected from RealClearPolling.com](https://www.realclearpolling.com/latest-polls/election) Results were taken from the most detailed reports found and had to include the number of respondents ($N$). In cases where presidential preference questions were directed to subgroups, the applicable $N$ was applied. - -*Multistate* - - - - [Bloomberg/Morning Consult: conducted August post-convention](https://www.bloomberg.com/news/articles/2024-08-29/election-2024-poll-harris-leads-or-ties-with-trump-in-swing-states?leadSource=uverify%20wall) - - [Bloomberg/Morning Consult: conducted after July 21](https://pro-assets.morningconsult.com/wp-uploads/2024/07/Bloomberg-Swing-State-Wave-10.pdf) - - [Bloomberg/Morning Consult: conducted April](https://pro-assets.morningconsult.com/wp-uploads/2024/04/Bloomberg_2024-Election-Tracking-Wave-7.pdf) - - [Bloomberg/Morning Consult: conducted July pre-July 21](https://pro-assets.morningconsult.com/wp-uploads/2024/07/Bloomberg-Election-Tracking-Wave-9-Toplines-Crosstabs.pdf) - - [Bloomberg/Morning Consult: conducted March](https://pro-assets.morningconsult.com/wp-uploads/2024/03/Bloomberg_2024-Election-Tracking-Wave-6.pdf) - - [Bloomberg/Morning Consult: conducted May](https://pro-assets.morningconsult.com/wp-uploads/2024/05/Bloomberg-Election-Tracking-Wave-8-Toplines-Crosstabs.pdf) - - [CNN: conducted August after convention](https://s3.documentcloud.org/documents/25088820/cnn-polls-across-six-battlegrounds-find-georgia-and-pennsylvania-are-key-toss-ups.pdf) - - [CBS/YouGov: conducted early September](https://www.cbsnews.com/news/harris-trump-poll-pennsylvania-michigan-wisconsin-debate/) - - [Emerson College: conducted April](https://emersoncollegepolling.com/trump-holds-edge-over-biden-in-seven-key-swing-state-polls/) - - [Emerson College: conducted August after convention](https://emersoncollegepolling.com/august-2024-swing-state-polls-toss-up-presidential-election-in-swing-states/) - - [Emerson College: conducted July pre-Harris](https://docs.google.com/spreadsheets/d/1zJrIOcXtzIRkaa34BDkxoVe9HY3stwFc/edit?gid=1704598980#gid=1704598980) - - [Emerson College: conducted June](https://docs.google.com/spreadsheets/d/1vGeTKW3MRDR5dXHM2IjM8ORz7HOyP5Le/edit?gid=532631346#gid=532631346) - - [Emerson College: conducted March](https://emersoncollegepolling.com/category/state-poll/) - - [Fox News: conducted August post-convention](https://www.foxnews.com/official-polls/fox-news-poll-harris-closes-gap-trump-sun-belt-states) - - [New York Times/Sienna: conducted May](https://www.nytimes.com/interactive/2024/05/13/us/elections/times-siena-poll-registered-voter-crosstabs.html) - - [Trafalger Group: conducted August](https://pollingplus.com/news/pollingplus-exclusive-top-two-presidential-cycle-pollsters-towery-and-cahaly-release-battleground-polls/) - - [Wall Street Journal: conducted March ]((https://s.wsj.net/public/resources/documents/WSJ_Swing_States_Partial_March_2024.pdf)) - - [YouGov: conducted July pre-Harris](https://ygo-assets-websites-editorial-emea.yougov.net/documents/Times_SAY24_20240712_state_poll_results.pdf) ---- - -*Single State* - -* Arizona - - [American Greatness: conducted June](https://cdn.amgreatness.com/app/uploads/2024/06/AZ-June-Toplines.pdf) - - [American Greatness conducted early September](https://amgreatness.com/2024/09/06/arizona-a-dead-heat-between-trump-harris-trump-leads-on-issues-and-authenticity/) - - [CBS: conducted May](https://www.scribd.com/document/733845819/cbsnews-20240519-AZ-1-SUN#1fullscreen=1) - - [Emerson College: conducted June](https://docs.google.com/spreadsheets/d/1vGeTKW3MRDR5dXHM2IjM8ORz7HOyP5Le/edit?gid=532631346#gid=532631346) - - [Fox News: conducted June](https://static.foxnews.com/foxnews.com/content/uploads/2024/06/Fox_June-1-4-2024_ARIZONA_Topline_June-6-Release.pdf) - - [Fox News: conducted March](https://static.foxnews.com/foxnews.com/content/uploads/2024/03/Fox_March-7-11-2024_Arizona_Topline_March-13-Release.pdf) - - [Fox: conducted August after convention](https://www.foxnews.com/official-polls/fox-news-poll-harris-closes-gap-trump-sun-belt-states) - - [Insider Advantage: conducted August after convention](https://insideradvantage.com/arizona-trump-leads-by-one-point-gallego-up-by-four/) - - [Insider Advantage: conducted July pre-Harris](https://insideradvantage.com/top-line-cross-tabs-for-insideradvantage-az-nv-and-pa-july-15-16-surveys/) - - [New York Times: conducted August](https://www.nytimes.com/interactive/2024/08/17/us/elections/times-siena-poll-arizona-toplines.html) - - [Nobel Predictive Insights: conducted May](https://www.scribd.com/document/733845819/cbsnews-20240519-AZ-1-SUN#1fullscreen=1) - - [Public Policy Polling conducted July pre-Harris](https://www.nytimes.com/interactive/2024/us/politics/presidential-candidates-third-party-independent.html) - - [Rasmussen Reports: conducted June](https://www.rasmussenreports.com/public_content/politics/public_surveys/crosstabs_2_arizona_june_2024) - -* Georgia - - [Fox News: conducted April](https://static.foxnews.com/foxnews.com/content/uploads/2024/04/Fox_April-11-16-2024_GEORGIA_Topline_April-18-Release-1.pdf) - - [Insider Advantage: conducted July pre-Harris](https://insideradvantage.com/top-line-tabs-for-insideradvantage-fox5-atlanta-survey/) - - [Insider Advantage: conducted August post-convection](https://insideradvantage.com/north-carolina-trump-leads-harris-by-one-point-rounded-numbers-below-tabs/) -* Michigan - - [Mitchell Research and Communications: conducted May](https://www.realclearpolitics.com/docs/2024/Mitchell-MIRS_MI_Poll_Press_Release_-_Presidential_Race_517_PM_5-27-24.pdf) - - [Atlantic Journal Constitution: completed June](https://www.ajc.com/news/am-atl-poll-trump-edging-biden/2SN4MIOROZA4DFOFDNXE2CFCJU/) - - [CBS: conducted in April](https://www.scribd.com/document/727317994/Cbsnews-20240428-MI-SUN) - - [EPIC-MRA: conducted in July, pre-Harris](https://ssl2002.webhosting.comcast.net/epic-mra/press/Stwd_Survey_July2024_Media_Freq.pdf) - - [Fox News: conducted April](https://static.foxnews.com/foxnews.com/content/uploads/2024/04/Fox_April-11-16-2024_MICHIGAN_Topline_April-18-Release.pdf) - - [Fox News: conducted June](https://static.foxnews.com/foxnews.com/content/uploads/2024/06/Fox_June-1-4-2024_NEVADA_Topline_June-6-Release.pdf) - - [Fox News: conducted post-July 21](https://static.foxnews.com/foxnews.com/content/uploads/2024/07/Fox_July-22-24-2024_Michigan_Topline_July-26-Release.pdf) - - [Marketing Resource Group: conducted April](https://www.realclearpolitics.com/docs/2024/michigan-poll-presidential-election-Press_Release.pdf) - - [Mitchell Research and Communications: conducted March](https://www.realclearpolitics.com/docs/2024/Mitchell-MIRS_MI_Poll_Press_Release_-_Presidential_Race_12_NOON_3-20-24.pdf) - - [New York Times - conducted August](https://www.nytimes.com/interactive/2024/08/17/us/elections/times-siena-poll-georgia-toplines.html) - - [Quinnipiac University: conducted June](https://poll.qu.edu/images/polling/ga/ga06052024_ggwb04.pdf) - - [Quinnipiac University: conducted March](https://poll.qu.edu/poll-release?releaseid=3893) - - [Trafalger: conducted July pre-Harris](https://www.thetrafalgargroup.org/wp-content/uploads/2024/07/MI-Gen-Pres-Poll-Report-0718.pdf) - - [Trafalger: conducted August post-convention](https://www.thetrafalgargroup.org/wp-content/uploads/2024/08/MI-Gen-Pres-Poll-Report-0831.pdf) -* Pennsylvania - - [American Greatness: conducted after July 21](https://cdn.amgreatness.com/app/uploads/2024/07/PA-July-Toplines.pdf) - - [CBS: conducted April](https://www.scribd.com/document/727318459/Cbsnews-20240428-PA-SUN) - - [Emerson College: conducted August](https://emersoncollegepolling.com/pennsylvania-2024-poll-trump-49-harris-48/) - - [Fox News: conducted after July 21](https://static.foxnews.com/foxnews.com/content/uploads/2024/07/Fox_July-22-24-2024_Pennsylvania_Topline_July-26-Release.pdf) - - [Quinnipac: conducted August](https://poll.qu.edu/poll-release?releaseid=3902) -March](https://www.fandmpoll.org/franklin-marshall-poll-release-april-2024) - - [Trafalger: conducted August, post-convention](https://www.thetrafalgargroup.org/wp-content/uploads/2024/08/PA-24-General-0830-Poll-Report.pdf) -* Nevada - - [Insider Advantage: conducted August after convention](https://insideradvantage.com/nevada-trump-leads-by-one-point-rosen-holds-substantial-lead-in-senate-contest/) - - [New York Times: conducted August before convention](https://www.nytimes.com/interactive/2024/08/17/us/elections/times-siena-poll-nevada-toplines.html) -* North Carolina - - [ECU: conducted August after convention](https://surveyresearch-ecu.reportablenews.com/pr/north-carolina-election-heats-up-trump-leads-harris-by-1-point-in-north-carolina-stein-widens-advantage-over-robinson-in-race-for-governor) - - [Marist: conducted March ](https://maristpoll.marist.edu/wp-content/uploads/2024/03/Marist-Poll_North-Carolina-NOS-and-Tables_202403181357.pdf) - - [Carolina Journal: conducted August](https://www.realclearpolitics.com/docs/2024/Carolina_Journal_NC_August.pdf) - - [ECU: conducted June](https://surveyresearch-ecu.reportablenews.com/pr/trump-leads-biden-by-5-points-in-north-carolina-gubernatorial-election-remains-close-with-stein-up-1-on-robinson-trump-guilty-verdict-has-little-impact-on-nc-voter-intentions-for-november) - - [EPIC-MRA: conducted August](https://www.woodtv.com/wp-content/uploads/sites/51/2024/08/EPIC-MRA-poll-results-083024.pdf?ipid=promo-link-block1) - - [High Point: conducted May](https://www.highpoint.edu/src/files/2023/08/103memo.pdf) - - [Highpoint University: conducted March](https://www.highpoint.edu/src/files/2023/08/102memo.pdf) - - [Highpoint University: conducted May](https://www.highpoint.edu/src/files/2023/08/103memo.pdf) - - [Insider Advantage: conducted August post convention](https://insideradvantage.com/north-carolina-trump-leads-harris-by-one-point-rounded-numbers-below-tabs/) - - [Insider Advantage: conducted July pre-Harris](https://insideradvantage.com/top-line-cross-tabs-for-insideradvantage-az-nv-and-pa-july-15-16-surveys/) - - [Mason-Dixon: conducted April](https://thehill.com/homenews/campaign/4603458-trump-leads-biden-in-north-carolina-poll/) - - [North Carolina, conducted August](https://www.nytimes.com/interactive/2024/08/17/us/elections/times-siena-poll-north-carolina-toplines.html) - - [Quinnipiac: conducted April](https://poll.qu.edu/images/polling/nc/nc04102024_ncaa99.pdf) - - [WRAL: conducted March](https://wwwcache.wral.com/asset/news/state/nccapitol/2024/03/12/21325738/3247050-Poll_Report_-_PollPrint-DMID1-628w54pob.pdf) -* Wisconsin - - - [CBS: conducted April](https://www.scribd.com/document/727319278/Cbsnews-20240428-WI-SUN) - - [Fox News: conducted after July 21](https://static.foxnews.com/foxnews.com/content/uploads/2024/07/Fox_July-22-24-2024_Wisconsin_Topline_July-26-Release.pdf) - - [Fox News: conducted April](https://static.foxnews.com/foxnews.com/content/uploads/2024/04/b002d3b3-Fox_April-11-16-2024_WISCONSIN_Topline_April-18-Release.pdf) - - [Quinnipiac: conducted May](https://poll.qu.edu/images/polling/wi/wi05082024_wizz76.pdf) - - [Trafalger: conducted August post-convention](https://www.thetrafalgargroup.org/wp-content/uploads/2024/08/WI-Gen-Pres-Poll-Report-0831.pdf) - ---- -[^3]: Results selected for analysis here are for two-way preference questions if asked, except in cases in which Robert F. Kennedy, Jr. qualified for the ballot prior to poll. For polls with only multiple choices in addition to Harris and Trump, their respective percentages of responses were recorded. In all cases those percentages were normalized to 100% to reflect the relative, not absolute, support of the two candidates. ---- +[Links to original sources were collected from RealClearPolling.com](https://www.realclearpolling.com/latest-polls/election) Results were taken from the most detailed reports found and had to include the number of respondents ($N$). ## Demographics diff --git a/wi.md b/wi.md index 07752c6..9e99c59 100644 --- a/wi.md +++ b/wi.md @@ -7,48 +7,10 @@ title = "Wisconsin" # Model results -In the 2020 election President Biden won 50.32% (0.5032) of the votes cast for Biden or Trump in Wisconsin. This leaves out votes for third-party candidates. Taking the actual result as a starting point, the model introduces some uncertainty into the result to create a range of outcomes for that election from 50.27% to 50.37%. Next, the results of each month's polling are factored in on a rolling basis. When the plot shows that more of the credible interval lies to the left of the 2020 margin it indicates that Harris is losing ground compared to the 2020 election results, taking the polls at face value. +## Early September assessment -Assessments are based on three criteria. -* **Stringent**—Harris wins if all of the values in the credible interval (analogous to the confidence interval) are equal to or greater than his 2020 margin. -* **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. - -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.5030.5030.5030.50250.50350.01.0004
- -~~~ -## August assessment before convention - -Harris wins under the *Relaxed* criterion. +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -57,63 +19,30 @@ Harris wins under the *Relaxed* criterion. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.5030.5030.5030.50250.50360.01.00.49570.49570.49640.48040.51260.48690.5046
- - -~~~ - -## July assessment from beginning of Harris campaign - -Harris wins under the *Relaxed criterion* - + ~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.5030.5030.50280.50250.50360.01.0002
- -~~~ -## July assessment through end of Biden campaign +## August assessment after convention -Biden wins under the *Relaxed* criterion. +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -122,126 +51,29 @@ Biden wins under the *Relaxed* criterion. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.5030.5030.50330.50250.50360.01.00050.49150.49140.4860.46480.51590.47750.5054
- - -~~~ -## June assessment - -Biden wins under the *Relaxed* criterion. -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50310.50310.50310.50260.50370.01.0003
- - -~~~ - -## May assessment - -Biden wins under the *Relaxed* criterion. -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50310.50310.5030.50260.50370.01.0004
- - -~~~ - -## April assessment - -Biden wins under the *Relaxed* criterion. -~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.50320.50320.50320.50260.50370.01.0001
- - + ~~~ -## March assessment - -Biden wins under the *Relaxed* criterion. +## August assessment before convention +Harris is likely to lose—most of the credible interval is less than 50% of the two-candidate vote. ~~~ @@ -249,58 +81,28 @@ Biden wins under the *Relaxed* criterion. + + - - - - - - - - - + + + + + + +
median mean modeminmax q025 q975mcserhat
0.50310.50310.50320.50260.50370.01.00030.49670.49670.49430.46680.52390.48250.5108
- - -~~~ - -## 2020 election + ~~~ - - - - - - - - - - - - - - - - - - - - - - - -
medianmeanmodeq025q975mcserhat
0.5030.5030.5030.50250.50360.01.0007
- -~~~ ## Scenarios The scenario tables below show the possible outcomes that involve Wisconsin. Wisconsin is represented in 42 of the 128 possible outcomes. *The combinations shown are those representing swing states taken by Harris.*