| Item | Value |
|---|---|
| R | R version 4.5.2 (2025-10-31) |
| Platform | aarch64-apple-darwin20 |
| Quarto | 1.8.26 |
| Packages | In sync with renv.lock |
| mlr3mbo | 1.3.0 |
| bbotk | 1.13.1 |
| DiceKriging | 1.6.1 |
| ranger | 0.18.0 |
| ggplot2 | 4.0.4 |
Reproducibility
Spending to the Frontier: how to rerun the analysis and where the results can mislead
Every number on this site is computed from three versioned inputs: the assumptions register (data/assumptions_register.csv), the study configuration (config/study.yml) and the bibliography (references.bib). Nothing is downloaded during a render. The pipeline writes its results to cache/, and the pages only read them, so rendering the same commit with the same package versions and the same cache gives the same results. This page explains how to rebuild the site, records the environment it was built in, and states where the results can mislead.
Quick start
The code and data are in the GitHub repository seeking-eureka/bayesian-optimization-cyber-budget. To rebuild everything from a clean copy:
git clone https://github.com/seeking-eureka/bayesian-optimization-cyber-budget
cd bayesian-optimization-cyber-budget
Rscript -e 'renv::restore()' # once: install the package versions pinned in renv.lock
rm -rf _freeze && quarto render # renders from the committed results in cache/
Rscript scripts/run_all.R --force # optional: recompute every result (about 11.5 hours)The rendered site is written to docs/. scripts/run_all.R runs every pipeline step in order (see Pipeline). Rscript scripts/run_all.R --quick runs a small version of every step in a few minutes and writes to cache/quick/; render against it with SF_CACHE_DIR=cache/quick quarto render.
Environment
How to read the table
Each row is one piece of software this page was built with and its version. The “Packages” row says whether the installed R packages match the versions pinned in renv.lock. The named packages are those the results depend on most: the Bayesian optimization framework, its optimization core, the Gaussian process surrogate, the random-forest surrogate used as a check, and the plotting package.
What the table tells you
If your versions match these and the packages are in sync, rebuilding the project should give the same numbers. If they differ, small differences in the results may come from the software rather than the analysis. The Gaussian process fit is the most version-sensitive step, because its internal optimizer can settle on slightly different settings and so propose different allocations.
Pipeline
| Script | What it does | Main outputs |
|---|---|---|
R/_setup.R |
Loads packages, sources R/01 to R/11, reads the configuration and register, validates the register |
cfg, reg |
R/01_assumptions.R |
Register reader, validator, parameter draws, lever lists | param(), draw_parameters(), active_levers() |
R/02_loss_model.R |
Spliced severity with mean-excess matching, common random numbers, event counts, scenario losses, common shock | make_crn(), simulate_scenario() |
R/03_response_curves.R |
Response curves, effect map, symmetric overlaps, allocation-to-multiplier conversion | allocation_to_multipliers() |
R/04_simulator.R |
One evaluation of an allocation; verification checks; analytic expected loss | simulate_allocation(), ale_analytic() |
R/05_optimize.R |
Stick-breaking search space, objectives, V1/V2/V3 searches, finalists, fixed-budget frontier, knee, near-optimal region | run_bo_single(), build_frontier() |
R/06_baselines.R |
Comparison methods, greedy and exact benchmarks, three-lever and full grids, regret, hypervolume | baseline_*(), ground_truth_grid6() |
R/07_robustness.R |
Parameter draws with per-draw optima, regret with Wilson intervals, verdict rule, level and decision sensitivity, value of information, identity case | robustness_draws(), robustness_verdict() |
R/08_figures.R, R/11_report.R |
Figures, tables and summaries for the pages | Plots and tables |
R/09_cache.R, R/10_parallel.R |
Result cache with input hashes; socket-cluster parallel map | save_result(), par_map() |
R/12_transfer.R |
Risk-adjusted cost of risk and the insurance comparison | ratcor(), transfer_comparison() |
scripts/run_all.R |
Runs every pipeline step in order, skipping fresh cached results | cache/*.rds |
Each page sources R/_setup.R in a hidden first chunk and reads results with load_result(). No page runs the optimizer.
| Step | Runtime (minutes) | Built |
|---|---|---|
| calibration | 0.0 | 2026-12-02 21:32 |
| verification | 0.3 | 2026-12-02 21:33 |
| surrogate_demo | 0.2 | 2026-12-02 21:33 |
| v1 | 1.6 | 2026-12-02 21:34 |
| finalists | 0.2 | 2026-12-03 00:39 |
| v2 | 3.5 | 2026-12-02 21:38 |
| v3 | 3.6 | 2026-12-02 21:41 |
| baselines | 1.7 | 2026-12-02 21:43 |
| ground_truth | 2.3 | 2026-12-02 21:45 |
| ground_truth6 | 124.2 | 2026-12-02 23:50 |
| frontier | 48.8 | 2026-12-03 00:38 |
| region | 0.0 | 2026-12-03 00:39 |
| efficiency | 0.0 | 2026-12-03 00:39 |
| robustness | 488.5 | 2026-12-03 08:47 |
| sensitivity | 11.6 | 2026-12-03 08:59 |
| identity | 0.9 | 2026-12-03 09:00 |
| transfer | 0.0 | 2026-12-03 09:00 |
How to read the table
Each row is one step of scripts/run_all.R, in the order it runs. Runtime is the measured wall-clock time of the production run on 12 cores, with up to eight parallel workers. Built is when the cached result was written. Steps run in sequence because later steps read earlier results: the finalists need V1, and the robustness tests need the finalists and the frontier.
What the table tells you
The full pipeline took 687 minutes. The robustness step is the longest because it finds each of 300 parameter draws’ own optimum, so most of a rebuild is spent on robustness, not on the main results. A reader who changes only the register’s control effects must rerun every step, because each result records the hashes of the register and configuration it was built from.
Data
There are no external data files. The register’s values are taken from published studies cited in references.bib; the simulated losses are generated by the project’s code from those values. The checksums below identify the exact inputs used in this render. A different checksum means a different file.
| File | Size (KB) | MD5 |
|---|---|---|
| data/assumptions_register.csv | 17.4 | 4c1218b3aea894914d6abc94234ee38b |
| config/study.yml | 5.5 | 6386d9fbac3584acd1d8be10f8709aa2 |
| references.bib | 10.3 | eddb4cd7495db413afece10588727db1 |
How to read the table
Each row is one input file. The MD5 column is a checksum: a short fingerprint computed from the file’s exact contents, so changing even one character gives a completely different fingerprint. The register holds every model input, the configuration holds the simulation and optimizer settings, and the bibliography holds the sources behind the register’s evidence grades.
What the table tells you
Anyone rerunning the analysis can compute the same checksums on their copies. If every fingerprint matches, they are working from identical inputs; a mismatch means a file differs, and any difference in results should be traced to that file first. The pipeline makes the same check automatically: each cached result stores hashes of the register and configuration, and a mismatch triggers a rebuild.
Parameters and seeds
All model inputs live in data/assumptions_register.csv, each with a range, an evidence grade and its sources (Model). Simulation, optimizer and robustness settings live in config/study.yml, shown below. Randomness is seeded explicitly from study: seed (20261130):
- The base-case common random numbers use the seed itself. Every allocation is scored on the same 1,000,000 simulated years.
- Optimizer replicate k uses seed + k. Finalist re-scoring uses seed + 1,000 + k. Frontier budget i uses seed + 300 + i. Robustness draws use seed + 500 (main) and seed + 700 (widened ranges), and the per-draw optimizer in draw i uses that offset + i. Within one set of simulated years, scenario s uses streams seed + s (counts) and seed + 100 + s (severities), and the common shock uses seed + 200 and seed + 201.
- Each run seeds itself with
withr::with_seed(), so results do not depend on the number of cores or the order in which parallel workers finish.
Tests
Core functions are covered by testthat tests in tests/testthat/. Run them with Rscript tests/testthat.R.
| File | Tests | Covers |
|---|---|---|
| test-assumptions.R | 5 | Register loads and validates; under-reporting rule for insurance-based rates; appetite rule; draws stay within ranges |
| test-cache.R | 1 | Saving, loading and stale detection |
| test-loss-model.R | 7 | Splice continuity, mean-excess matching and dominance over the lognormal; count monotonicity under common random numbers; under-reporting factors; independent scenario streams; common shock; analytic expected loss |
| test-response.R | 4 | Response-curve properties; symmetric pair overlaps; effect map; multipliers bounded and never rising with spend |
| test-simulator.R | 5 | Zero spend matches the baseline; each scenario affected only by its own levers; excluded levers inert; output structure; runtime |
| test-search-space.R | 4 | Stick-breaking map and its inverse; cap feasibility; weight repair; Pareto front; knee rule; grid sizes |
| test-optimize.R | 1 | Quick V1, V2, greedy and exact runs return the documented structure; warm starts never do worse than their start |
| test-robustness.R | 6 | Draws, shrink and widen change only their target rows; Wilson interval and verdict rules; regret never negative; risk pricing and insurance helpers |
| test-figures.R | 2 | Every figure and table function runs on quick-run results; no V1 or stress point dominates the frontier |
How to read the table
Each row is one test file. Tests counts the test blocks it contains, and Covers lists what they check. Every block contains one or more expectations. The suite runs in a few minutes, mostly because the runtime test simulates 1,000,000 years and the optimizer test fits small Gaussian processes. The figure tests need the quick cache from Rscript scripts/run_all.R --quick.
What the table tells you
The tests encode the plan’s specification: if a formula, the effect map or the common-random-number design changes, a test fails before any result is published. They check the code, not the inputs. A wrong register value passes every test, which is why the register is published in full with its evidence grades on the Model page.
Caching
- Result cache (
cache/*.rds).scripts/run_all.Rwrites one file per pipeline step, with the MD5 hashes of the register and configuration, the build time, the runtime and key package versions. A step is skipped when its file exists and the hashes match. Once a step is rebuilt, every later step is rebuilt too. Force a full rebuild with--force. The production cache (about 2 MB) is committed, so the site renders from a fresh clone without rerunning the pipeline;run_all.R --forceregenerates it.scripts/patch_robustness.Rre-scores a changed recommendation in the stored robustness draws without rerunning them. - Quick cache (
cache/quick/). Written by--quickwith small settings, for checking code and layout only. Its numbers are not results, and it is not in git. - Quarto freeze (
_freeze/)._quarto.ymlsetsfreeze: auto, so a fullquarto renderre-executes a page only when that page’s.qmdfile changes. Changes toR/scripts or to the cache do not count. After rerunning the pipeline or editing code, runrm -rf _freeze && quarto render.
Known limitations
Limits of reproducibility
- Bit-for-bit equality is expected only on the same platform and package versions. Floating-point and BLAS differences across machines can change low-order digits. Through the Gaussian process fit, that can steer the optimizer to slightly different allocations with near-identical scores.
- The pipeline runs on a socket cluster of up to eight workers. Each run seeds itself, so the worker count does not change results, but runtimes scale with the cores available.
- Quarto versions affect rendering, not the numbers.
- A full rebuild is slow. The clean
Rscript scripts/run_all.R --forcebehind these results took about 11.5 hours on the 12-core machine that built this site, and the quick check between 2 and 20 minutes. Most of the time goes to the robustness step: 300 parameter draws, each with its own optimum on 1,000,000 simulated years. Timed in the foreground, one draw takes about 5 seconds of work; in the background run, wall time ran far ahead of CPU time, which suggests operating-system throttling of background processes or memory contention among workers (not confirmed). The practical consequence is that any change to the register means an overnight rebuild; the cached results come from one end-to-end run of the final code. To shorten a rebuild, reducerobustness: n_effect_drawsandn_widen_drawsorsimulation: n_yearsinconfig/study.yml, at the cost of wider intervals and more Monte Carlo error.
Model limitations
Synthetic firm and inputs. The firm, its baseline maturity and the control costs are design choices. Results show how the method behaves, not what any real firm should spend.
Control effects are weakly evidenced. Most control-effect rows are graded weak, expert or gap. The allocation depends on them directly; the robustness tests show how much, but cannot replace measurement.
Mostly independent scenarios. Scenarios are independent in the base case. A common-shock stress test links ransomware and breaches; other common drivers are not modeled.
Static, one-year view. Spend buys an immediate, constant effect. Deployment lags, decay and attacker adaptation are not modeled.
Tail model. The tail is matched to the lognormal body’s mean excess and never sits below it, but its shape is weakly evidenced. Worst-year results depend on it.
Approximate per-draw optima. Each robustness draw’s TVaR95 optimum comes from greedy allocation plus a short search, not an exhaustive one, and greedy steps are $100K. Shares of draws within tolerance carry Wilson 95% intervals.
Deterministic, instant controls. Response curves are certain given spend, apart from the robustness draws. Controls take effect at once, with no implementation lag and no split between one-off and recurring cost.
One-year horizon. The model looks at a single year; multi-year effects, decay and renewal are not modeled.
No adaptive attacker. Attackers do not shift to weaker scenarios when controls improve, which would reduce the value of concentrated spending.
Expert-graded ransomware severity sets the level. The median and spread of ransomware losses are expert inputs, and they drive the TVaR95 level more than any control (see the tornado chart on the Robustness page).
Identity and MFA is modeled narrowly. The register assumes half of MFA’s possible effect is already in place, and it gives MFA no effect on data breaches or on loss size. Under alternative assumptions, the best identity share cuts TVaR95 by up to 12.1% rather than about 1% (Robustness). The firm’s actual MFA coverage is the input to confirm first.
Search reliability falls with dimensions. Before identity was promoted, a seven-lever identity search found a smaller gain than a simple share scan, and the six-lever Bayesian optimization runs stopped short of greedy allocation and the full grid. Results quoted here therefore rest on pooled finalists, the grid and the exact optimizer, not on one search.
| What would change the conclusions | Effect |
|---|---|
| Measured control effects much smaller than the register’s | Higher worst-year loss at every budget; the frontier shifts up, and the case for control spend weakens further |
| Correlated scenarios beyond the ransomware-breach link | Fatter tail; more value from levers acting on several scenarios (logging, resilience) |
| Insurance quotes far above the assumed loading | Controls become relatively more attractive than risk transfer |
| A ransomware loss median nearer the high end of its range | The largest single swing in worst-year loss (tornado chart) |
| No MFA in place today, or MFA that also prevents data breaches | Identity and MFA earns a meaningful share of the budget and worst-year loss falls further |
| A lower appetite | More spend needed; the frontier shows the cost directly |
| Synthetic assumption | Client data that would replace it |
|---|---|
| Scenario frequencies (insurance-based; scaled for firm size when the register was compiled, with no size parameter in the code) | The firm’s incident history and its insurer’s loss data |
| Severity medians and spreads | The firm’s incident costs, business-interruption estimates and claims data |
| Control effects and half-effect spend | Structured expert elicitation, vendor pilots, control-testing results |
| Current maturity (baselines) | Control assessments, such as endpoint coverage and patch latency |
Use the results to compare allocations and budgets on a consistent basis, to see which inputs matter most, and to frame the board’s questions. Do not use them as loss forecasts, as precise optimal allocations, or as evidence that a control works.
Licenses
The code on this site is released under the MIT License. The simulated data are generated by the project’s code from published values and carry the same license. The cited studies keep their own terms; the register quotes summary figures, not their data. Third-party software keeps its own terms:
| Source | Terms |
|---|---|
| mlr3, mlr3mbo, bbotk, paradox, mlr3learners | LGPL-3 |
| DiceKriging | GPL-2 or GPL-3 |
| ranger | GPL-3 |
| lhs | GPL-3 |
| emoa | GPL-2 |
| nloptr | LGPL-3 or later |
| data.table | MPL-2.0 |
| ggplot2, gt, withr, testthat | MIT |
Session information
The site was built with R and Quarto. The analysis loads ggplot2, mlr3, mlr3mbo, bbotk, paradox and mlr3learners, and also calls DiceKriging, ranger, lhs, emoa, nloptr, data.table, gt, digest, withr, lgr, yaml, knitr, dplyr, tibble, purrr and sessioninfo. Package versions are pinned in renv.lock; run renv::restore() to install them.