Senedd Constituency Forecaster

Run seat simulations from your latest forecast and explore decision-support outputs.

Forecast Configuration

Configuration Tips
  • base_shares: Expected vote share for each list (must sum to 100%).
  • concentration: Lower values increase variation (typical range: 20-200).
  • swing_sd: Bloc swing standard deviation (typical range: 0.01-0.06).
  • swing_rho: Correlation between left/right swings (range: -0.9 to 0.9).

Simulation Settings

Status

Idle

Summary

No run yet.

Downloads

Instructions

BTNforecast Instructions

This document explains the modelling approach in plain language and gives step-by-step instructions for running a simulation.

A plain-English overview

This tool estimates how seats might be allocated in a 6-seat constituency using the D'Hondt method and closed lists. It does this by running many simulations rather than producing a single prediction. Each simulation is a plausible election outcome based on your base forecast and a set of assumptions about uncertainty and shared swings between parties.

Key ideas in simple terms:

This gives you answers like:

What the model assumes

1) The base forecast is the starting point - The values in forecast.yaml are the best estimate of vote shares. - They should add up to 100% (the tool will renormalize if they do not).

2) Shared swings happen within blocs - Lists are grouped into a left bloc and a right bloc. - Before each simulation, the model applies a shared swing to the left bloc and a shared swing to the right bloc. - This captures the idea that parties in the same bloc often move together.

3) There is additional random variation around the swung forecast - After the bloc swing, the model draws a random vote share around that new forecast using a standard probability distribution (Dirichlet). - This accounts for noise and day-to-day uncertainty in polling or turnout.

4) Seats are allocated using D'Hondt - Each simulated vote share is converted into seats using the D'Hondt method. - The seat allocation is deterministic given the simulated vote shares.

What the key settings mean

All key settings live in forecast.yaml:

How to run a simulation (CLI)

1) Install dependencies (first time only)

bash python -m venv .venv source .venv/bin/activate pip install -r requirements.txt

2) Edit the forecast

3) Run the simulation

bash python -m btnforecast simulate --config forecast.yaml --out outputs

4) View outputs

How to run the web UI

Hosted deployment: https://btnforecast.onrender.com/

1) Start the server

bash AUTH_TOKEN=your-shared-token uvicorn app:app --reload --host 0.0.0.0 --port 8000

2) Open the UI

Authentication token (hosted deployment)

The hosted UI requires a shared token. Paste it into the "Shared token" field in the web interface before running a simulation. This value should have been provided to you by the service owner or team lead.

How to interpret the main outputs

Practical tips for campaign planning