Methods and Code

Our work is based on a mathematical model by Alexandria Volkening, Daniel F. Linder, Mason A. Porter, and Grzegorz A. Rempala. The model takes a compartmental SIS approach and accounts for interactions between voters in different states. Adapting ideas from mathematical biology, we study the evolution of the percentages of Democratic, Republican, and undecided or other voters in time. We use polling data aggregated by FiveThirtyEight that we average by month to determine the parameters in our model, and we use the model to simulate 10,000 elections with demographics-correlated noise to generate our forecasts. To see how our approach performed in 2020, check out this this website, and see this paper for our accuracy between 2012 and 2018.

All of the code to reproduce or build on our forecasts is available here.


To forecast the 2022 races, we build on an SIS compartmental modeling approach that was previously applied to U.S. gubernatorial, senatorial, and presidential elections in 2012, 2016, 2018, and 2020. To determine our model parameters, we use polling data from FiveThirtyEight. To help determine the states that appear in our safe red and safe blue superstates, we use the ratings by 270toWin (the consensus version), FiveThirtyEight, and Sabato's Crystal Ball. To determine the main candidates in each race, we use data from FiveThirtyEight. We include correlated noise in our model based on state-level demographic information from the U.S. Census Bureau and education data from the Federal Reserve Bank of St. Louis. We provide our references below:

  • 270toWin (the consensus version).
    Accessed: 24-07-2022.
  • Annual Estimates of the Resident Population by Sex, Race, and Hispanic Origin: April 1, 2020 to July 1, 2021.
    Source: U.S. Census Bureau, 2022. Accessed: 24-07-2022.
  • Best R, Bycoffe A, Groskopf C, King R, Koeze E, Mehta D, Mithani J, Radcliffe M, Wiederkehr A, Wolfe J, Jones-Rooy A, Rakich N, Shan D, Frostenson S, Mason J, Mangan A, Yee C.
    FiveThirtyEight: Latest Polls.
    FiveThirtyEight's data is under a CC BY 4.0 license.
    Accessed daily.
  • Chian S, He WL, Lee CM, Volkening A.
    2020 U.S. Election Forecasts with a Compartmental Model.
    Accessed 24-07-2022.
  • DeSandro D.
    Intro to CSS 3D transforms.
    Accessed 24-07-2022.
  • Educational Attainment, Annual: Bachelor's Degree or Higher by State.
    Source: FRED Economic Data, Federal Reserve Bank of St. Louis. Accessed: 24-07-2022.
  • Kondik K, Miles Coleman J, Sabato LJ.
    Sabato's Crystal Ball: 2022 Governor.
    Accessed 24-07-2022.
  • Silver N, Groskopf C, Frostenson S, Ganesan M, Mason J, Best R, Mejia E, Boice J, Bycoffe A, Scherer E, Buonocore F, Ellis J, Burton C, Radcliffe M, Barry C, Cohen M, Mehta D, Mithani J, Shan D, Wiederkehr A, Wolfe J, Yuan Y.
    FiveThirtyEight 2022: Governors.
    Accessed: 25-07-2022.
  • Volkening A, Linder DF, Porter MA, Rempala GA.
    Forecasting Elections Using Compartmental Models of Infection.
    SIAM Review, Vol. 62, No. 4: 837-865. (arXiv version: arXiv:1811.01831).