# How it Works

The Election Scenario Explorer allows you to examine how state electoral outcomes influence the national election. How does the outlook change if Florida goes to Trump? What if the rust belt goes to Biden?

## Conditional Probability in Action

When the page is first loaded, it shows the updated electoral outcome probabilities calculated by the Economist election model. States are color-coded according to probabilities, the electoral college win probabilities and expected electoral vote totals are shown at the top, and state win probabilities are shown at the bottom. Also shown are entropy and variance; these measure the uncertainty of the outcome and are discussed further below.

Election scenarios are created by assigning the outcomes of states to one party or the other. Clicking on a state will assign that state to the Democratic candidate. Clicking on it again will assign it to the Republican candidate. Clicking for a third time will unassign the state. States with assigned outcomes are filled with a stripe pattern, and all the currently assigned states appear along the line below the top table. States in the darkest shades of blue or red cannot be assigned, because the election model already gives them a 100% chance of turning out one way or the other.

As your scenario changes, the electoral map and the accompanying tables will update automatically, with values now calculated using conditional probabilities reflecting the assumption that all of the states in the scenario turn out as assigned. This allows you to examine not only how the different states affect the national election outcome, but also how states affect each other.

For example, if you click on Georgia to assign it to the Democratic candidate, you will immediately notice that Georgia has turned dark blue and filled in with a stripe pattern, indicating that Georgia is now part of the election scenario. You will also see that other states will have turned more blue because the outcomes of different states are correlated. The probabilities in the top table will have shifted towards the Democratic candidate, and the state table below the map will be updated as well. If you click on Georgia again, you can re-assign it to the Republican candidate, and the probabilities will shift in the other direction.

In addition to choosing specific states to assign, you can use the buttons above the map to explore scenarios. The "Random State" button chooses an unassigned state at random and assigns it a random outcome based on the probabilities of the underlying model. "Random Sample" repeatedly assings states at random until the election outcome is completely determined, effectively generating an entirely filled-out electoral map. "Clear" resets the map by unassigning all states.

The "Scenario Probability" box above the map shows how likely your scenario is to occur. And if you find a particularly interesting scenario, you can copy the address from the link below the map; it will take you to a page that opens directly with the current scenario.

## Entropy and Variance

The last two values in the table above the map show two measures of the uncertainty of the national election given the current scenario. Entropy is an information-theoretically based measure of uncertainty, and variance is a statistical measure of "how far the needle moves." Both are displayed in units such that a value of 1 corresponds to 50-50 odds, and a value of 0 indicates that the outcome is completely determined by the current scenario (see below for technical details). In calculating entropy and variance, electoral college ties are treated as having a 50% chance of going to either candidate.

In the bottom table, the expected amount that the entropy and variance will decrease upon revealing the outcome of each state is shown. These values serve as measures of the influence that each state has on the national outcome.

On average, the release of new information decreases (or at least does not increase) uncertainty. This is why values for expected reduction in entropy and variance are non-negative. But, while the expected uncertainty cannot increase, the actual uncertainty can. Since the Democratic candidate is currently favored, assigning a state to the Republican will usually result in increased uncertainty (unless, of course, the effect is so overwhelming that the Republican probability overtakes the previous Democratic probability).

Assigning state outcomes will change not only the national uncertainty, but also the level of influence of other states. A state that began with relatively low influence on the national outcome can become pivotal in certain scenarios, and vice versa. By exploring different scenarios you can track not only which states start out as most influential, but also which states might turn out to become the most influential as other state outcomes are revealed.

## Probabilities, Conditional Probabilities, and Simulations

All calculations are based on the Economist election model, which publishes a daily set of 40,000 election simulations. The probability of any given event is simply the fraction of these simulations for which the event occurs: $P[Z] = \frac{\text{# of simulations where } Z \text{ occurs}}{ \text{total # of simulations}}.$ As individual state outcomes are assigned, the values are recomputed using probabilities conditional on the specified scenario. Denoting the scenario by $$A$$, this amounts to using only the simulation results where $$A$$ occurs: $P[Z \mid A]=\frac{\text{# of simulations where both } Z \text{ and } A \text{ occur}} {\text{# of simulations where } A \text{ occurs}}.$

## Formulas

Denote by $$N_D$$ and $$N_R$$ the events corresponding to the outcome of the national election, and $$S_D$$ and $$S_R$$ the outcomes of a given state election. As noted above, for variance and entropy calculations, we assume that electoral college ties are effectively decided by a coin toss, which means that $$P[N_D]+P[N_R]=1$$. The entropy values shown are calculated in bits, meaning that the logarithm used is base 2, and a fair coin toss has entropy of 1. For the national outcome entropy in the top table, the formula is $-\bigl(P[N_D]\log_2P[N_D]+P[N_R]\log_2P[N_R]\bigr).$ For the expected reduction in entropy, the formula is $\sum_x P[S_x]\sum_y P[N_y\mid S_x]\bigl(\log_2P[N_y \mid S_x]- \log_2P[N_y]\bigr),$ where $$x$$ and $$y$$ range over the two parties. Technically, this value is the difference between the original entropy and the conditional entropy with respect to the state outcome.

The variance calculations are based on a random variable which takes values of $$1$$ or $$-1$$ depending on which candidate wins the election. The variance will then be 1 if the two outcomes are equally likely. The variance formula is $1 - (P[N_D]-P[N_R])^2 = 4P[N_D]P[N_R].$ The expected reduction in variance is equal to the variance of the conditional expectation with respect to the state outcome, and the formula is $4 \sum_x P[S_x]\bigl(P[N_D]P[N_R]-P[N_D\mid S_x]P[N_R\mid S_x]\bigr)= 4 \sum_x P[S_x]\bigl(P[N_D\mid S_x]-P[N_D]\bigr)^2.$

Created by Dan Fernholz and Ric Fernholz.