Skip to content

Under the hood

How Quantik works

Quantik answers one question: given everything we are unsure about, how much could this project cost, and how confident can we be in a number? It does that by running your Excel estimate thousands of times, each time with a different, plausible set of values.

01 · The idea in one minute

A single-point estimate says "earthworks will cost $6.7M". Everyone knows it might be $6.2M or $7.6M. A risk register says "there is a 40% chance we hit rock". Adding the worst cases together gives a number nobody believes; adding the most likely values ignores the risk.

Monte Carlo simulation does something better. For each iteration it picks one value for every uncertain item from its range, decides whether each risk happens, and lets Excel recalculate the total. After 10,000 iterations you have 10,000 equally plausible totals. Sort them and you can read off:

  • P50: the total that half the iterations came in under (the median);
  • P90: the total that 90% of the iterations came in under;
  • contingency: P50 or P90 less the base estimate.
In plain terms

P90 is not "the worst case". It is the budget that, on the information in the model, you would expect to be enough nine times out of ten.

02 · The simulation pipeline

Quantik drives Excel's own recalculation, so any formula you can write in Excel works in a model: lookups, IF statements, links between sheets. A run has six steps.

  1. 1DiscoverA full recalculation in which every Quantik function registers its cell, name, arguments and correlation group.
  2. 2SampleOne column of random numbers per input, drawn by Latin Hypercube in blocks of 1,000, each from the input's own stream.
  3. 3CorrelateIman–Conover reorders the columns so related inputs move together, without disturbing each input's distribution.
  4. 4IterateFor each iteration Excel recalculates; each input returns the value at its random number, using its arguments as they are at that moment.
  5. 5RestoreThe workbook goes back to its static values (mean, most likely or P50, as you choose).
  6. 6ReportStatistics, percentiles, precision, sensitivity, charts, the contingency sheet and a run log entry.

Before a run starts, Quantik refuses to go ahead if any distribution cell has invalid arguments (for example a minimum above the maximum). During the run, an iteration whose output is an Excel error is excluded and counted, never recorded as $0. Only the active workbook is simulated; Quantik functions in other open workbooks hold their static values.

03 · Latin Hypercube sampling

Plain Monte Carlo picks random numbers independently, so by chance some parts of a range are over-sampled and the tails are under-sampled. Latin Hypercube sampling (LHS) splits each input's 0–1 probability scale into equal strata and draws exactly one value in each stratum, then shuffles the order. Every part of every range is represented, so percentiles settle with fewer iterations.

Monte Carlo versus Latin Hypercube sampling Ten random draws on a 0 to 1 scale. With Monte Carlo the draws cluster and leave gaps; with Latin Hypercube there is exactly one draw in each tenth of the scale. Monte Carlo Latin Hypercube 0 1 probability scale (each tick is one stratum) gaps below 0.1 and above 0.8
Ten draws each. LHS puts one draw in every tenth of the scale; Monte Carlo leaves the tails empty by chance.

Quantik draws the hypercube in blocks of 1,000 iterations. Each block is a complete Latin Hypercube on its own, which is what lets Quantik measure its own precision (batch means across blocks) and stop early without breaking the stratification. You can switch to plain Monte Carlo in Settings.

The random number generator is xoshiro256** (Blackman and Vigna), with a separate, non-overlapping stream for every input. Values come from each distribution's inverse cumulative distribution function, so a random number of 0.9 always gives that input's P90.

04 · Identity streams (common random numbers)

Each input's random numbers are tied to its identity, its name and function, not its position in the workbook. That has a practical consequence: adding, removing or switching off one risk does not change any other input's samples.

Position streams versus identity streams When risk R03 is switched off, position-based streams shift every later input to a new stream, so results move by sampling noise. Identity streams keep every other input on the same stream. By position By identity (Quantik 0.7 default) R01 → stream 1 R02 → stream 2 R03 switched off R04 → stream 3 was stream 4 Every later input resamples: noise in the bridge. R01 → stream(R01) R02 → stream(R02) R03 switched off R04 → stream(R04) Nothing else moves: the change is the change.

This is what makes the Revision Bridge, Scenarios and the correlation test show real differences rather than resampling noise. In testing, switching off one risk left the inherent cost and the opportunities exactly unchanged. Settings → Random streams → By position restores the earlier behaviour if you need it.

05 · Correlation in the run

Correlation is applied to the random numbers, before any value is calculated. Quantik uses the Iman–Conover method: it reorders each input's column of LHS draws so that their rank correlation matches what you asked for. Because it only reorders, every input keeps exactly its own distribution and every stratum is still sampled once.

  • Within a group (for example all bridge rates), inputs share a correlation ρw, set with SYN.CORR("group", ρ) or the Correlate button.
  • Between groups, a two-level factor model adds a correlation ρb (default 0.3). It grows linearly with the number of inputs, so it scales to large BOQs.
  • Impossible combinations (for example ρ = ±1, or inconsistent pairs) are repaired to the nearest valid matrix, and the run says so.
  • The achieved rank correlation, within and between groups, is reported after every run.

Why this matters so much is covered in Risk modelling: correlation.

06 · From iterations to results

Horizontal bars of teal points spreading from a central axis above a road construction site
Sensitivity: the inputs whose swings move the total most rise to the top of the tornado. Illustration.

Once the iterations are done, Quantik sorts each output and reports:

ResultHow it is worked out
P-values (P1–P99)Percentiles of the simulated totals (Excel's PERCENTILE.INC convention). P50 is the median, not the mean.
ContingencyPnn less the cell named SYN_BaseEstimate, at every confidence level.
PrecisionA 95% interval on P50 and P90 from batch means across the 1,000-iteration blocks (order statistics for a single block).
TailP95, P99 and the mean of the worst 10% and 5% (expected shortfall, or CVaR).
TornadoHow far P50 or P90 of the total moves when one input sits in its own bottom or top 10% while everything else varies. A risk event is compared occurred against not occurred.
Contribution to P90Each component's average in the iterations nearest the total's P90 (an Euler allocation), shown with its ± precision.
Share of varianceStandardised regression coefficient × correlation, which has no units, so quantities in m³ and rates in $/m² rank fairly.
Tornado chart: change in P90 Illustrative tornado. Each bar shows how far the P90 of the total moves when one input is low or high. The longest bars, at the top, are the drivers to work on first. Ground conditions (driver) Bridge deck area (quantity) Rock in cut (risk event) Asphalt rate Wet weather (risk event) P90 of the total (illustrative) ← lower higher →
Illustrative tornado. A risk occurrence and its impact always show as one driver, never two rows.

07 · Reproducible by design

A reviewer should be able to open the workbook, press Run and get the same answer. Quantik makes that possible in four ways:

  • Fixed seed. The seed is always reported, and a fixed seed gives the same result every time.
  • Settings in the workbook. Every setting is saved inside the workbook, so it travels with the file.
  • Run log. Every reported run is appended to the Quantik Run Log sheet: time, user, version, iterations, sampling, streams, seed, mean, P50, P90 and P90 precision.
  • Settings hash and input fingerprint. Two short hashes in the log change whenever a setting, a distribution, a range or a name changes. Equal values mean the same model and settings, so the same seed reproduces the run exactly.

08 · Speed and limits

Because every iteration is a real Excel recalculation, speed depends on the workbook. Measured speeds are 450–730 iterations per second on 29–56-input QRA workbooks and about 400 per second on the 137-input highway job, so 10,000 iterations take roughly 15–25 seconds. Close other workbooks while running: Excel recalculates every open workbook.

Known limits
  • Correlation matrices (RiskCorrmat, SYN.CORRMAT) are applied exactly as entered and are not linked to other groups by the between-group correlation.
  • Distribution fitting to historical data and copulas are not included.
  • Reports are built in Excel and exported to PDF; there is no Word report writer.