Algorithmically Targeting Voting Precincts To Win An Election, Part 1

Ray Manning
10 min readJan 15, 2021

--

Part 0. Executive Summary

How do you win an election in a political district that you have previously lost? How do you target voters and precincts to switch to your side for an upcoming election? Where do you focus your limited resources to provide the best chance of winning?

These are interesting questions and have a myriad of answers. Namely, expand your base, capture the cross-over vote, go after the fence-sitters, chase the suburb vote, etc. For every one of these answers is a counterpoint based on contrary logic. And none of these answers is based upon mathematical principles. Rather they are based on past experience and intuition.

Can an election strategy to be guided by mathematics, data, and algorithms?

This effort makes a first effort at developing a methodology of how and where to spend limited resources in order to maximize the chance of winning an election. The methodology assumes that the election “is within reach” and that targeting specific voters and precincts can get the win.

Part 1. Background

Strategies to target and attract voters come in all shapes and size. Many of these strategies are based upon what worked in the past. One work which is very generic is the NDI Campaign Skills Handbook (Ref. 1) which highlights “…an electoral campaign must target its limited resources only to those voters who are most likely to support it”. In that work there are good qualitative methods to employ but no quantitative methods. On the other hand, there has been a sizeable effort at the term “voting power” related to the possibilities that a given set of votes can affect the outcome of an election (Ref. 2). That work does not yield information related to where to find voters with voting power or how to target them. Finally a big data approach is described in Reference 3 where databases of detailed information on voters is used to decide electoral strategies. To some extent, many big data approaches border on the invasion of privacy and the Reference 3 authors admit “…the most valuable information campaigns acquire comes from the behaviors and direct responses provided by citizens themselves” as opposed to big data methods.

This approach uses publicly-available data and a constrained function minimization algorithm to determine least cost methods of trying to swing voters from one party to another. The approach provides guidance as to where to target spending (either resources or time) to win an election.

The 36th Assembly District of the state of California provides a fun and competitive example of voter-flipping strategies. The district itself is located northeast of the city of Los Angeles and is a primary exurb of Los Angeles located in the Antelope Valley. Every two years since 2012, the same two Democrat and Republican candidates have been competing against each other in the general elections. Each having beat back challengers within their own primaries during various years.

Figure 1 shows the recent history of primary (magenta) and general (green) election outcomes for this Assembly District (Ref. 4). In 2012 the incumbent Democrat candidate won a razor thin 50.1% to 49.9% general election to retain the seat (green 2012 bar in Figure 1). The general election Democrat vote dropped to as low as 40% in 2014 as the seat was lost in the four subsequent general elections.

Note that in the 2016 , 2018, and 2020 general elections (shown in green in Figure 1), the Democrat vote is stuck between 45% and 48% of the vote. With these scenarios, what precincts in the 36th Assembly District should be targeted in order to flip voter preferences? How best to spend the limited finances to make these precinct flips occur?

Figure 1. California Assembly District 36 Historic Voting Results

Part 2. Methodology

California Assembly District voting results from the March 2020 primary were obtained from Reference 5. These results contained the number of votes cast for the Democratic party candidates and the Republican party candidates by precinct. The raw votes were converted to percent Democrat and percent Republican vote for each precinct. The possibility of outlier precincts due to small vote totals were removed by eliminating any precincts with less than twenty total votes cast.

The calculation of which precincts to target was posed as the constrained minimization problem

subject to the inequality constraints

where Vi is the derived percent Democrat vote in precinct i, Voi is the baseline percent Democrat vote for each precinct from the primary election, TDEM and TREP are the total calculated Democrat and Republican vote, and bi is a “cost” factor associated with each precinct.

In words, the algorithm is trying to find the least percent changes in vote for each precinct in order to make the overall Democrat vote total exceed the overall Republican vote total. In addition, lower and upper bounds on the percent Democrat vote are enforced to provide realism.

The bi is a cost factor that can be applied precinct-by-precinct if one has a priori knowledge of how difficult specific precincts’ voting tendencies will be to change. The bi can also be used in a tiered fashion where bi is unity for small changes in percent vote and increases to three or five, for example, as the percent changes in a precinct’s vote get larger. This tiered approach increases the cost or penalty for the algorithm to make larger percentage changes. In other words, it’s easier to get a 1% change in precinct vote than a 10% or 20% change.

If Vi is equal to Voi for each and every precinct, then the function to be minimized is exactly zero and the TDEM and TREP values are equal to the baseline primary vote values for each party. This Vi equal to Voi serves as the starting point in the optimal strategy algorithm as it tries to find votes to change in a minimal cost effort.

During the optimization process, as Democrat vote percentages increase, the calculated number of votes is added to the Democrat total and subtracted from the Republican total. Thus maintaining the same total number of votes in each precinct.

The constrained minimization algorithm to determine optimal vote acquisition strategies was implemented in Python and run for various scenarios as described below.

Part 3. Results

During every scenario that was run, the initial Democrat vote percent was set to the baseline primary election values and votes were counted. This setup served as a check to make sure that the baseline primary election results were indeed obtained and we can have some confidence that there were no obvious flaws in the program logic or coding. This was then used as the starting point for each run.

Note that in the 2020 primary election, there is a difference of 8% between the Republican votes at 54% and the Democrat votes at 46%. Thus vote percent differences in the 8% region are going to be required to win the general election.

Since the primary election results showed a loss by the Democrat contender of 8%, one obvious strategy would be to increase the vote in each and every precinct by 8%. Or another obvious strategy would be to say you’re going to increase the total vote in each precinct by 8% and they’ll all be new Democrat voters. These and other obvious strategies do have possibilities of winning the election but are not likely to happen.

A final fact to remember is that the first 50 precincts (index-wise) are heavily Republican precincts with Republicans gathering 60–80% of the vote. Precincts 50–120 (index-wise) are heavily Democrat with vote percentages in the 50–70% range. Accordingly positive percent vote increases in precincts 1–50 from the optimization routine are trying to flip voters from Republican to Democrat. Contrarily positive percent vote increases in precincts 50–120 from the optimization routine are trying to “pile on” in the Democrat precincts.

A first election strategy was derived using all bi set to unity indicating equal difficulty in changing the vote in any precinct. This might be a good starting point if one has no a priori knowledge of the costs of campaigning in each precinct. Figure 2 shows the resulting vote percent gained in each precinct and will be discussed below (after the introduction of other voting strategy runs).

Figure 2. Precinct Percent Gained, Uniform Penalty

A second election strategy was derived using a tiered bi with unity, three, and five values used for different tiers in the deviation of percent Democrat vote from the primary results. The results of optimization runs made with the tiered penalty are shown in Figure 3.

Figure 3. Precinct Percent Gained, Tiered Penalty

A final election strategy was derived using a bi which increases linearly as you deviate from the baseline primary vote. This penalty represents the case where it’s fairly cheap to get a 1% increase in vote but increasingly expensive as higher percent vote changes are required.

Figure 4. Precinct Percent Gained, Linear Penalty

The results from the uniform penalty (Figure 2) and tiered penalty (Figure 3) are similar. Precincts 50–120 with more available votes and Democrat leanings get 6–12% increases in Democrat vote. Precincts 1–50 with a smaller number of votes available and Republican leanings see 2–4% increases. The tiered penalty results tend to see more evenly distributed vote increases but it’s fairly subtle.

With the introduction of a more severe penalty for large vote percent changes comes a very uniform increase in vote percentages as seen in Figure 4. Most precincts across the spectrum are in the 6–8% range. This result makes sense deviations from a smooth vote percent increase are substantially penalized.

Figures 5 and 6 show where the vote count comes from for the uniform penalty runs and the linear penalty runs. (Tiered penalty runs not shown since they were similar to the uniform penalty runs.)

Whereas Figure 5 shows 23 precincts with greater than 40 votes gained (using the uniform penalty), Figure 6 shows only 9 precincts above 40 votes gained (with the severe linear penalty). Just this difference in voting results gives the Democrats a gain of 1100 votes in the 23 precincts compared with 500 votes in the 9 precincts. Thus the optimization routine has found the precincts with the most numbers of overall votes in Democrat leaning areas to concentrate on. There would likely be more flipping of precincts back and forth in an election that was closer than the 8% initial deficit that was used in this example.

Figure 5. Precinct Votes Gained, Linear Penalty
Figure 6. Precinct Votes Gained, Linear Penalty

Figures 7 and 8 show the geographic distribution of precincts with vote percent increases color coded. The blue precincts are where the vote was increased 7% or more during the optimization process, the gold between 3% and 7%, and the green less than 3%.

Comparing Figures 7 and 8 shows that when the penalty increases for greater percent changes in voting, the optimizer “promotes” more precincts to higher levels of voting but also lowers the highest percent increases to avoid the severe penalties. For example, precinct 3550107A, which is the upper left blue precinct with the airport in it, goes from Democrat vote percent of 59% and 47 votes flipped with a uniform penalty to 57% and 40 votes contributed with the severe linear penalty. But it also increases precinct 0021280 near California City from 52% and 4 votes to 54% and 8 votes (as well as quite a few other smaller population precincts). It’s a small number of votes picked up in many precincts, but that’s how you win elections: namely “piling on” in your stronghold and doing “less bad” in your Achilles heel.

Figure 7. Precinct Percent Increases, Uniform Penalty
Figure 8. Precinct Percent Increases, Linear Penalty

Part 4. Commentary

Elections are won by picking up many votes where you typically run strong, swinging fence-sitting voters, and trying to do “less bad” where you run weak. Up to now, decisions on how to obtain votes in these three categories was based upon experience from previous elections. This effort derived a mathematical method on how to target precincts and voters to obtain votes and minimize costs. Results from the method can guide campaign strategies to help win elections.

It should be noted that this current algorithm gives the minimum deviation from prior voting results without telling one how to accomplish those changes. The next article in this series will look at the demographics of each precinct and determine better precinct costs per vote (i.e., bi) as well as campaign strategies.

References

1. “Campaign Skills Handbook”, O’Connell, S., Smoot, S., and Khalel, S.A., National Democratic Institute, https://www.ndi.org/sites/default/files/Campaign%20Skills%20Handbook_EN.pdf.

2. “The Mathematics and Statistics of Voting Power”, Gelman, A., Katz, J.N., and Tuerlinckx, F., Statistical Science, Vol 17, No 4, 2002, pp. 420–435.

3. “Political Campaigns and Big Data”, Nickerson, D.W. and Rogers, T., Harvard Kennedy Research Working Paper Series, RWP13–045, 2013.

4. “California State Assembly District 36”, Ballotpedia, https://ballotpedia.org/California_State_Assembly_District_36.

5. “The Redistricting Database for the State of California”, University of California, Berkeley, https://statewidedatabase.org/.

--

--