Skip to main content

EV Adaptation model Denmark: verification

Version 0.2 (BETA) · checks run on 28–29 November 2026

How the EV Adaptation model (Elbil-tælleren) is checked: automated tests, a monthly release gate, a symbolic check of the methods note, a backtest and an independent code review.

This page lists every check that has been run on the model behind Elbil-tælleren, with the results, including the failures and the open issues. Nothing here is a formal proof. The tests compare the code against independent oracles, the symbolic check recomputes the equations and numbers of the methods note, and the review is a second opinion by a different AI model.

Summary

Check Result
Automated tests (Python, development repository) 79 of 79 pass
Van backtest (2 origins, 4 comparisons, v0.2) Median absolute error 6.0% against 29.5% and 31.2% for two baselines; observed value inside the 80% band in 4 of 4; not better in every comparison
Monthly release gate (every refit) Input checks on the source data, then R-hat < 1.01, no divergent transitions, effective sample size > 400; otherwise last month’s forecast stays online
Symbolic check of the methods note (SymPy, run on the version of 28 November before the second round of fixes) 138 claims checked: 136 pass, 2 failed and corrected in the note; 19 not machine-checkable
Rolling-origin backtest (3 origins, 7 comparisons) Observed BEV stock inside the 80% band in 7 of 7; a development comparison, not an independent test
Independent code review (Codex, 28 November 2026, cars) 11 findings: 7 fixed, 4 addressed in the text and labels, none open
Independent code review (Codex, 29 November 2026, vans, v0.2) 11 findings: 8 fixed, 3 addressed in the text and labels, none open

Automated tests

The tests run with python -m pytest src in the development repository; the production subset of the code is published in tools/ev-fleet/pipeline/.

Area What is checked
Share model The Kalman-filter likelihoods equal a direct evaluation of the same multivariate normal density (an independent oracle); the logistic curve, the sampling variance, the December/January dummies, and that fuel shares sum to one
Market size Gompertz end points and its differential equation; the AR(1) likelihood against a direct multivariate normal; recovery of known Gompertz parameters from simulated data; the exit-rate identity
Stock-flow simulation The stock-flow identity holds every month and draw; negative sales are clipped without breaking it; a milestone already reached in the data keeps its observed month; the month noise of the share forecast has the estimated size
Exits by fuel Conservation in the exit allocation; the share- and age-linked exit rules recover known slopes and saturate; the observed young share from BIL21 excludes the all-ages row; the age anchor is the year of the starting rate
Tax and CO2 module Per-car figures against a hand calculation; components add up; scenario quantiles are ordered; the turn-of-the-year case (2026 complete, no 2026 months in the forecast)
Export and data The month-over-month archive; observed headline inputs; a revision of the data without a new month triggers a refit; missing source counts are caught and a genuine zero passes; earlier survival-model code
Vans (v0.2) The van stock-flow step keeps the identity and never gives negative electric-van scrappage; the damped trend levels off where theory says; the two-fuel split against the base fuel; the young-diesel measure; the van/lorry/tractor input checks; the monthly check for a new van month

Monthly release gate

The model is refitted automatically when Statistics Denmark publishes a new month (GitHub Action). Before any fit, the source data are checked: a count that Statistics Denmark leaves out may not become a zero, the latest month must have the total, electric, petrol and diesel counts, and the fuels must add up to the published total in every month from 2012. A refit also runs when Statistics Denmark revises earlier months without adding a new one. A fit is published only if every parameter has R-hat below 1.01, there are no divergent transitions, and the effective sample size exceeds 400. If a fetch, a fit or the export fails, nothing is committed and the previous forecast stays online.

Since version 0.2, vans, lorries and road tractors are updated in a separate job with its own timeout, which commits only its own files. A failure there keeps last month’s van and lorry figures online and does not affect the car forecast, and a failure in the car job does not stop the van update. The van update also runs when Statistics Denmark revises the van or lorry data without adding a month (a fingerprint of the input data), and the van fits pass the same convergence gate as the car fits.

Symbolic check of the methods note

This check covers the car sections of version 0.1. The van section added in version 0.2 has not been checked symbolically.

Every labelled equation and numeric claim in the methods note was translated into SymPy and recomputed, with the numbers checked against the model output files (report, re-runnable script).

  • 138 claims checked, 136 passed. The identities of the Gompertz curve, the logistic share curve, the exit-rate rules and the stock-flow identity hold, and every cell of the backtest table matches the backtest output.
  • 2 failed, both corrected in the note. The note said that BEVs were 2% of the fleet at the December 2020 origin; the share was 1.2% (2% is the share a year later). It also gave 8–21% for how often the BEV scrappage floor binds; the current backtest gives 11–24%, and that number is now generated from the backtest output.
  • 19 claims are not machine-checkable, for example modelling assumptions and statements about the data sources.

The check is conditional on the translation from LaTeX to SymPy, which the report prints for every claim. It was run before the second round of fixes on 28 November. Since then the backtest numbers have changed slightly (month noise added to the share forecast); the backtest table is generated from the backtest output, and the numbers in the text were updated by hand.

Backtest

At each origin the data are cut, the model is refitted, and the forecast is compared with the stock that was later observed. Error of the median BEV stock forecast:

Origin After 1 year After 2 years After 3 years
December 2020 −19% −8% −6%
December 2022 −0.3% −6% −11%
December 2024 −3.5%

The model beats a linear trend and a frozen-share baseline at every origin and horizon, but it still underpredicts the BEV stock. This is a retrospective comparison made during development, not an independent test: the exit rule, its 60-month window and the prior on the long-run BEV share were chosen after these results had been seen. The monthly archive of forecasts is the proper test, and it starts with version 0.1.

Vans (v0.2)

The van model was tested in the same way from two origins, with the share curve, the trend and the exit rate refitted on the data up to each origin. Error of the median electric-van stock forecast:

Origin After 1 year After 2 years After 3 years
December 2022 +3.6% +11.4% +6.2%
December 2024 −5.8%

The first baseline holds the total van stock at its level at the origin (median absolute error 29.5%), and the second holds the fuel shares of sales at their last 12-month values (31.2%). The model is not better in every comparison: one year after the 2024 origin, the flat-stock baseline is closer (+3.2%). The constant exit rates for diesel vans were chosen after the 2022 result had been seen, because the age link chose a spurious slope on four years of data there. Lorries and road tractors have no forecast, because their data start in 2021.

Independent code review

The first review below covers version 0.1 (cars). The van code in version 0.2 was reviewed separately on 29 November 2026 (second table).

On 28 November 2026 the code, data, methods note and app were reviewed by Codex (OpenAI), with the instruction to find what is wrong or misleading.

# Finding Status
1 The tax figures rest on assumed tax rates (the 2020 average registration tax comes from a parliamentary answer that has not been verified against the source) Addressed: the whole section is labelled as an illustration with assumed tax per car against an all-petrol comparison
2 The tax section would have disappeared in January 2027 Fixed, with a regression test
3 The exit rate and its age anchor referred to different dates Fixed: anchored at the year of the starting rate
4 The young-share proxy overstated the young fleet, because exported cars stayed in the count Fixed: observed ages from Statistics Denmark (BIL21)
5 The bands leave out monthly sales noise and the dependence between model layers Fixed for the sales noise; the dependence between layers is stated as a limitation in the methods note
6 The backtest uses choices made with hindsight Addressed: stated in the methods note and on this page
7 Registration tax on used imports and export refunds is not included Addressed: the page states that the registration component covers new cars only
8 A revision of history without a new month does not trigger a refit, and a failed run leaves no visible warning Fixed: revisions trigger a refit (fingerprint of the input data); a failed tax calculation is flagged on the page
9 A suppressed count in the source data could become a zero Fixed: input checks before every fit, with tests
10 A milestone that has been reached would keep moving into the future Fixed: a reached milestone shows its observed month, with a test
11 Some labels state more than is computed (for example a fixed 15-year life in a label) Fixed: the label uses the chosen lifetime; undiscounted cost and unweighted grid CO2 are stated

Review of the van code (version 0.2)

# Finding Status
1 Setting the driving or the diesel use to zero froze the CO2 chart Fixed
2 If a tab failed to load, the previous tab’s numbers could appear under the new labels Fixed: content is hidden while loading and after a failed load
3 Revised van or lorry data without a new month did not trigger an update Fixed: fingerprint of the input data, separately for vans and for lorries/tractors
4 A failure in the car update could stop the van update, and a slow van fit could stop the car commit Fixed: two independent jobs with their own timeouts and commits
5 The backtest used the 1 January van stock (BIL8) before it was published Fixed: annual counts are cut by their publication date; backtest rerun
6 The backtest gate was described differently from how it is computed, and a failed gate did not stop anything Fixed: the criterion is stated (pooled errors, plus coverage) and a failed gate returns an error
7 The 2030 band for the electric share of van sales leaves out the uncertainty of the ceiling Addressed: the band is labelled as conditional, and the methods note reports a sensitivity with a lower ceiling (100,000 electric vans in March 2031 instead of October 2030)
8 The CO2 figures assume that electric vans drive as much as the average van, and the band covers only the number of vans Addressed: both stated on the page and in the methods note
9 The flat-stock baseline did not start exactly at the observed stock Fixed; every simulated path now starts at the observed stock
10 The age-rule sensitivity used the dispersion of the flat rule Fixed
11 The first eleven months of the 12-month share for lorries and tractors used shorter windows Fixed: the chart starts when a full 12-month window exists

Version history

A new version is released when the model, the vehicle coverage or the methods change. The monthly data refresh does not change the version.

Update to version 0.2, 30 November 2026 (no change to the model or the forecast)

  • Methods note rewritten in plainer language, with a figure of the model structure, a notation table and a statement on the use of AI. No equation or number was changed.
  • The header of the page shows the date on which the current data were retrieved.

Version 0.2 (BETA), 29 November 2026

  • New tab for vans: a monthly forecast of electric vans to 2040 with four milestones, based on the same stock-flow approach as for cars, with a damped trend for the van stock, constant diesel exit rates and a ceiling on the electric share of sales based on the EU zero-emission rule for new vans from 2035.
  • New tab for lorries and road tractors, with actual figures only.
  • CO2 from electric vans, with assumptions that can be changed on the page. The diesel use of 8 litres per 100 km is a provisional value.
  • Leased vehicles are included in all vehicle classes, because the register counts the user of a vehicle.
  • Methods note extended with a section on vans, lorries and road tractors.
  • The monthly update fetches and refits vans in separate steps, so a problem with the van data keeps last month’s van figures and does not affect the car forecast.
  • The car forecast is unchanged.

Version 0.1 (BETA), 28 November 2026

  • Passenger cars: monthly forecast of electric cars to 2040, with milestones, a tax and CO2 illustration, the methods note, this verification page and the monthly update. All 11 findings of the independent code review were closed the same day.

What is not checked

The model’s assumptions themselves (the long-run BEV share, the import rule, the link between the age of the fleet and its exit rate) are not verified by any of these checks; the methods note states them and the backtest tests their combined effect. The tax and CO2 figures are illustrations built on stated assumptions, which can be changed on the page.