NHS bed occupancy simulator

Methods

This page describes exactly what the simulator does. The full source code is in the GitHub repository; the model itself is a single file, js/model.js, which is the same code your browser runs and the code used for calibration.

In one paragraph. The model simulates individual (synthetic) patients arriving at English general & acute hospital beds over a year: emergency patients arriving through the day and night with seasonal and weekly patterns, and planned patients arriving on weekdays. Each patient needs a bed for a random length of time, some stay longer because their discharge is delayed after they are medically fit, and discharges only happen during the day. If no bed is free, emergency patients wait (the model's equivalent of a "trolley wait" in A&E after a decision to admit) and planned admissions are lost. Unknown quantities are tuned so that the model reproduces published 2025/26 figures, then you change the inputs and see what happens.

Why a simulation rather than a formula?

A simple ratio, occupancy = beds needed ÷ beds available, gives the average occupancy but says nothing about how often hospitals run out of beds. Patients do not arrive evenly: demand varies by hour, weekday and season, and lengths of stay vary enormously. Running out of beds happens on the busy days, so the average hides the problem. A discrete-event simulation reproduces that variation and counts the consequences: waits for a bed and lost planned admissions. The simple ratio is still shown as a check on the Validation page.

Model structure

Beds

Emergency patients

Corridor care

NHS England defines corridor care as care for 45 minutes or more in a clinically inappropriate place. Since May 2026 it has published two counts (experimental statistics). The model represents both:

Neither group counts towards bed occupancy, which, like KH03, counts only patients in proper beds. The ward count comes from 2026/27 while the other targets are for 2025/26. The model is compared on the same calendar days.

Planned (elective) overnight patients

How each setting works

The settings are grouped into things policy can change (capacity, public health, hospital flow) and context that it cannot directly change (population, winter severity). Each one changes a specific model input; the "What the model is running" table on the Model page shows the resulting inputs, so you can check every effect.

Hospital capacity

Public health

Risk factors change the number of people who need admitting. For a risk factor with prevalence p and relative risk of admission RR (people with the risk factor compared with people without), the population attributable fraction is the standard epidemiological formula

PAF = p (RR − 1) / (1 + p (RR − 1))

and changing prevalence from p₀ to p₁ multiplies admissions by

(1 + p₁ (RR − 1)) / (1 + p₀ (RR − 1))

RR is taken from published research or derived from a published count of attributable admissions (the sources are on the Data & sources page). Several risk factors are combined by multiplying their effects, which assumes they act independently. The effect is applied to both emergency and planned admissions.

Long-run effects. These are the effects once a change in prevalence has fully worked through. In reality the benefits of stopping smoking or losing weight build up over years (an ex-smoker's risk falls gradually), so these settings describe where a policy leads, not what happens the year it starts.

Hospital flow

Population (context)

Emergency demand is built up by age band:

admissions(band, year) = admissions(band, base year) × population(band, year) / population(band, base year)

so admission rates per head are held at base-year levels and only the size and age structure of the population change. Each band has its own length-of-stay and delayed-discharge multipliers (older patients stay longer and are more often delayed). Population comes from ONS mid-year estimates and projections.

Calibration

Most inputs are measured directly (bed numbers, admissions, the age profile, delay lengths, the flu season's timing). The rest cannot be observed, so each is tuned until the model reproduces one measured figure: for 2025/26 where it is published, otherwise the latest available year, as shown in the table. The fitted values and their targets are listed on the Data & sources page.

Fitted quantityMeasured target
Median length of stayAverage G&A occupancy at midnight (KH03)
Share of emergency patients going home the same dayShare of emergency admissions with no night in hospital (HES zero bed day cases, 2023/24)
Spread of length of stayShare of occupied beds with patients in hospital 21+ days (daily sitrep)
Share of patients delayed once fitShare discharged after their Discharge Ready Date
Weekend dischargingWeekend/weekday discharge-rate ratio (discharge sitrep)
Weekday spread of planned admissionsWeekly pattern of winter occupancy (daily sitrep)
Size of the flu wavePeak flu patients in G&A beds (winter daily sitrep)
Effective bed pool sizeToday's system: share of emergency admissions waiting >12 hours from decision to admit, 2025/26 (A&E). Pre-pandemic flexibility: 2018/19 12-hour waits counted from arrival, converted to the same units (see limitations)
Corridor care spaces on wardsPatients in corridor care on G&A wards at 08:00, May to September 2026 (NHS England, experimental)

Parameters are fitted one at a time by bisection, cycling until all targets are met together (scripts/calibrate.mjs, using the same model code as this website). Other measurements are kept back to test the model: see Validation.

Public-health effects: which evidence?

This project estimated the effect of smoking, obesity and flu vaccination on emergency admissions from local-authority data (scripts/effects_analysis.py). The analysis showed that area data cannot isolate these effects: placebo tests fail and some signs are implausible (see Validation). So by default the simulator uses:

Randomness and accuracy

Each result is the average of many simulated years (30 for "today's system"; for the "more flexible system", whose pools are larger, enough years to simulate the same total number of beds). The baseline and your scenario use the same simulated patients. Arrivals are drawn at a fixed reference rate and thinned to the scenario's demand, and each patient has their own random numbers. A scenario with less demand removes some patients and leaves the rest unchanged, so differences reflect your changes rather than chance. Long waits are much noisier than occupancy, because they depend on rare runs of busy days. The 95% range for the level of today's 12-hour waits is roughly ±2 percentage points of emergency admissions (the ± figure shown on the Model page). Changes are far more precise than that, because the baseline and the scenario share their random numbers: the Model page tests each change run by run and labels it “no clear change” when it is smaller than about two standard errors of the paired difference.

Main limitations