Cost-benefit analysis primitives from the HM Treasury Green Book, in R.
The Green Book is HM Treasury’s guidance on how to appraise and evaluate proposals involving UK public spending. It sets the rules every central-government department, devolved administration, and arm’s-length body follows when deciding whether a policy, programme, or capital project is worth funding. The latest edition was published in 2026.
The guidance covers six core areas:
vintage = "2003".The Green Book is supplemented by topic-specific guidance from HMT, DESNZ, DfT, and DHSC.
A practitioner appraising a public-spending option typically:
Today this is mostly done in spreadsheets, with discount factors and
parameter tables hand-typed from PDFs. greenbook puts the
same primitives in R so an appraisal becomes code that can be tested,
reviewed, and reproduced.
No existing R or Python package implements the Green Book. UK appraisal practitioners hand-roll the same discount factors and parameter lookups every time. The arithmetic is simple but the parameters change: STPR is kinked across six bands, optimism bias has a six-category schedule, DESNZ publishes a carbon path to 2100, METB shifted from 30 to 20 percent in 2018.
greenbook solves three problems:
gb_appraisal
carries vintage metadata for the parameter tables it used.
gb_data_versions() shows source and last-updated date for
every bundled table.The package is pure computation: no network calls, no API keys.
Bundled parameter tables in inst/extdata/ are refreshed via
data-raw/ scripts.
# install.packages("greenbook") # not yet on CRAN
# Development version:
devtools::install_github("charlescoverdale/greenbook")library(greenbook)
# 10-year cashflow: capex in years 0-2, benefits in years 3-9
costs <- c(100, 50, 50, 0, 0, 0, 0, 0, 0, 0)
benefits <- c(0, 0, 0, 30, 30, 30, 30, 30, 30, 30)
# One-call full appraisal with optimism bias and METB
app <- gb_appraise(
costs, benefits,
ob = "non_standard_buildings", ob_mitigation = 0.5,
metb = TRUE,
base_year = 2024
)
summary(app)
# Equivalent annual net benefit
gb_eanc(app)
# Distributional weighting
gb_dist_weighted_npv(
cashflow = rep(30, 5),
recipient_income = rep(15000, 5),
income_data = seq(10000, 100000, length.out = 10)
)
# Carbon emissions
gb_carbon_npv(rep(100, 7), 2024:2030, base_year = 2024)
# Wellbeing
gb_wellby(1, persons = 100, years = 5, base_year = 2024)
# Inspect bundled vintages
gb_data_versions()| Family | Functions |
|---|---|
| Discounting | gb_stpr(), gb_discount_factor(),
gb_discount(), gb_npv(),
gb_eanc() |
| Real / nominal | gb_deflator(), gb_real(),
gb_rebase() |
| Optimism bias | gb_optimism_bias(), gb_apply_ob(),
gb_categories() |
| Distributional | gb_dist_weight(),
gb_dist_weighted_npv() |
| Valuation | gb_wellby(), gb_vpf(),
gb_qaly() |
| Carbon | gb_carbon_value(), gb_carbon_npv() |
| Adjustments | gb_metb() |
| Appraisal | gb_appraise(), gb_compare(),
gb_progression(), gb_place_based(),
gb_economic_case(), gb_validate() |
| Risk | gb_risk_register() |
| Sensitivity | gb_sensitivity_ob() |
| Reporting | gb_headline(), gb_cost_per_unit(),
gb_to_latex(), gb_to_excel(),
gb_to_word() |
| Lookups | gb_schedule_table(),
gb_data_versions() |
Every parameter table is sourced from a published HMT, DfT, or DESNZ
workbook. gb_data_versions() returns the full
provenance.
| Table | Source |
|---|---|
| STPR schedule | HMT Green Book supplementary guidance: discounting, October 2026
(plus the pre-October 2026 schedule as vintage "2003") |
| GDP deflator (1990-2031, 2025 = 100; 2026 onwards are OBR forecasts) | HMT GDP deflators, October 2026 (Budget) release |
| Optimism bias upper bounds | HMT Supplementary Green Book Guidance: Optimism Bias (Mott MacDonald 2002) |
| METB | HMT Green Book 2022 |
| WELLBY (10k / 13k / 16k, 2019 prices) | HMT Wellbeing Guidance for Appraisal, July 2021 |
| QALY (DHSC 70k / NICE 20k, 30k) | DHSC Supplementary Green Book Guidance + NICE HTA |
| VPF (anchored 2023 = GBP 2,474,341) | DfT TAG data book v2.03FC, December 2025, Table A4.1.1 (WTP element) |
| DESNZ carbon (2020-2050, 2022 prices) | DESNZ Valuation of Energy Use and GHG Emissions for Appraisal, November 2023, Table 3 |
data-raw/ contains the refresh scripts: each downloads
the published workbook, parses the relevant sheet, and rewrites the
bundled CSV.
The independent Green
Book Discount Rate Review (Freeman and Groom, June 2026) recommended
a lower and flatter schedule. HM Treasury adopted it on 28 October 2026,
and greenbook 0.2.0 makes the new schedule the default:
Before 28 October 2026 (vintage = "2003") |
From 28 October 2026 (vintage = "2026-10",
default) |
|
|---|---|---|
| Years 1 to 30 | 3.5% | 3.00% |
| Years 31 to 75 | 3.0% | 2.50% |
| Years 76 to 125 | 2.5% | 2.25% |
| Beyond year 125 | 2.0% to 1.0% | not discounted: use other methods |
| Health and catastrophic-risk schedules | 1.5% and 3.0% baselines | withdrawn: one rate for all proposals |
| Elasticity of marginal utility (distributional weights) | 1.3 | 1.25 |
To reproduce an appraisal made under the earlier guidance, pass
vintage = "2003" (or the edition label,
"2018", "2022" or "2026-02") and
eta = 1.3:
gb_npv(c(-100, rep(30, 9)), vintage = "2003")| Package | Description |
|---|---|
magentabook |
Companion: HM Treasury Magenta Book evaluation primitives (appraisal-to-evaluation spine) |
obr |
OBR fiscal forecasts (CBA inputs, public finances) |
ons |
UK Office for National Statistics data (GDP deflator, CPI, demography) |
inflateR |
Inflation adjustment for real-terms cashflows |
inflationkit |
Inflation analysis (deflators, persistence) |
debtkit |
Debt sustainability analysis (links public-sector NPV to debt path) |
ivcheck |
IV diagnostics (for causal impact estimates feeding the appraisal) |
If you use greenbook in published work, please cite
via:
citation("greenbook")The package citation and the underlying HM Treasury Green Book are both returned.
Report bugs or request features at GitHub Issues.
cost-benefit-analysis, appraisal, hm-treasury, green-book, public-policy, economics, discounting, npv, social-time-preference-rate, optimism-bias, distributional-weighting, wellby, value-of-statistical-life, carbon-valuation, desnz