# TheEconomist/us-potus-model

Code for a dynamic multilevel Bayesian model to predict US presidential elections. Written in R and Stan.

Repository: https://github.com/TheEconomist/us-potus-model
Canonical: https://ross.abutalabs.com/products/us-potus-model
Homepage: https://projects.economist.com/us-2020-forecast/president
Language: HTML
License: MIT
License Family: permissive
Last push: 2020-10-15T16:41:36+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 2392, "days_push": 2148, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1268, forks 189 (observed 2026-08-28T04:04:11.473594+00:00)

## What it is
Code for The Economist's dynamic multilevel Bayesian model to forecast US presidential elections, written in R and Stan. It aggregates state and national polls with corrections for partisan non-response, survey mode, and population, producing state-level and electoral college predictions.

## Use cases
- forecast us presidential election outcomes from polling data
- run a bayesian multilevel poll aggregation model in stan
- backtest election forecasting models on 2008 2012 2016 data
- adjust polls for partisan non-response and survey mode bias
- model state-level correlations for electoral college prediction

## When to choose
- you need a well-documented, peer-reviewed Bayesian election forecasting model
- you want to reproduce or extend The Economist's 2020 US presidential forecast
- you work in R and Stan and need a real-world multilevel time-series modeling example

## When to avoid
- you need forecasts for non-US elections or non-presidential races
- you want a maintained, actively updated tool - it was built for the 2020 election cycle
- you need a production service or GUI rather than R scripts

## Facets
- artifact type: application
- maturity: maintenance
- function: machine-learning, data-science, data-visualization
- domain: data-science, analytics
- platform: python, cli
- tags: bayesian-model, stan, election-forecasting, r, polling, political-science, politics

## Member repositories
- TheEconomist/us-potus-model (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:11.473594+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T05:03:36.153889+00:00, confidence not recorded.
  - readme: https://github.com/TheEconomist/us-potus-model (fetched 2026-08-28T04:04:11.473594+00:00, sha 7451ebf07fb5)
  - homepage: https://projects.economist.com/us-2020-forecast/president (fetched 2026-08-29T12:15:15.371113+00:00, sha 329f17d4dd4f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
