TQBTHEQUANTBATEMAN
TQB/ learn/ numerical finance/ monte carlo estimationEN · DARK
Numerical finance · intermediate

Monte Carlo estimation

Turn expectations into estimators with visible uncertainty.

BY THE END, YOU CAN

01Build a seeded path estimator

02Report standard error and confidence intervals

03Separate sampling error from model error

01
INTUITION

Name the mathematical target and the approximation error.

Monte Carlo returns an estimate and an error bar; a price without both is incomplete.

01

Error decays as N⁻¹ᐟ².

02

Seeding makes diagnostics reproducible.

03

Discount pathwise before averaging.

02
WHY MARKETS CARE

Tie accuracy to the decision the number supports.

Path-dependent and high-dimensional claims often have no tractable closed form.

INSTRUMENTS

Asian options

callables

xVA exposure

QUOTE CONVENTION

Prices are present values; confidence levels and seeds are explicit.

03
MATHEMATICS

Separate estimator, discretization, truncation, and convergence.

Formula · Full derivation

Estimator

V^N=1N∑i=1NYi\widehat V_N=\frac1N\sum_{i=1}^{N}Y_i

The sample mean is unbiased when paths and discounting match the target law.

Full derivation
Full derivation

From information set to computable quantity

Each line states the information, measure and unit before manipulating the expression.

  1. 01

    Express price as expectation

    Fix measure, numeraire and payoff.

    V0=EQ[Y]V_0=E^Q[Y]
  2. 02

    Generate iid draws

    Map deterministic pseudorandom uniforms to the model factors.

  3. 03

    Average discounted payoffs

    Compute the estimator and unbiased sample variance.

    s2=(N−1)−1∑(Yi−Yˉ)2s^2=(N-1)^{-1}\sum(Y_i-\bar Y)^2
  4. 04

    Attach uncertainty

    Use a CLT interval only after checking tail behaviour and independence.

    V^N±1.96s/N\widehat V_N\pm1.96s/\sqrt N

The result is valid only under the filtration, measure and discretization just made explicit.

Inputs
  • N: path count
  • Ŷ: discounted sample payoff
Assumptions and limits
  • Convergence is slow for tight tolerances.
  • Discontinuous payoffs produce noisy sensitivities.
Formula · Short derivation

Standard error

SE⁡(V^N)=sYN\operatorname{SE}(\widehat V_N)=\frac{s_Y}{\sqrt N}

Quadrupling paths roughly halves sampling uncertainty.

05
MODEL / PRICING

Benchmark the algorithm against a controlled reference.

METHOD

Simulate under the pricing measure, discount pathwise and report estimate, standard error, seed and runtime.

CALIBRATION

Simulation parameters inherit the calibrated model; path count controls numerical precision, not fit.

06PYTHON IMPLEMENTATIONOpen the implementation and checks.
ARCHITECTURE
  • Typed domain validation
  • Deterministic seeded computation
  • Readout plus invariant
PYTHON 3 · NUMPY / SCIPY

Monte Carlo estimation

Reproduce the governing quantity, then challenge it with an invariant.

REUSABLE EXAMPLE
01import numpy as np
02
03def widehatvnfracnsumi(x: np.ndarray) -> float:
04 x = np.asarray(x, dtype=float)
05 assert np.isfinite(x).all()
06 return float(np.mean(x))
07
08sample = np.array([0.8, 1.0, 1.2])
09value = widehatvnfracnsumi(sample)
10assert sample.min() <= value <= sample.max()
11print(f"value={value:.6f}")
EXPECTED OUTPUTvalue=1.000000
SANITY CHECKS

✓ Finite inputs are enforced

✓ The result respects its numerical bounds

✓ Units and measure remain explicit

07
INTERACTIVE LAB

Change the error budget, not just the picture.

NUMERICAL ERROR LAB

Monte Carlo estimation

Use a fixed seed to separate discretization, sampling and truncation effects.

SYNTHETIC · EDUCATIONAL
Euler terminal error0.2987M=32
Milstein terminal error0.0083same shocks
Monte Carlo SE0.2108N=4,096
spot level by time (years)

Exact, Euler and Milstein spot paths using the same shocks.

  • exact
  • Euler
  • Milstein
time (years): 0.0Y. exact: 100.00. Euler: 100.00. Milstein: 100.00.

Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.

ERROR BUDGET

Model → algorithm → evidence

Each numerical approximation has an independent control and a reference diagnostic.

01Target lawQ / GBM

Measure and SDE fixed

02Algorithm32 steps

Discretization or transform control

03DiagnosticSE=0.211

Visible convergence evidence

MODEL BOUNDARY

GBM and Gaussian transform examples are analytical references, not production calibration engines.

08
FRONT OFFICE

Where the model meets the book.

ON THE DESK
“The sixth decimal is not information when the error bar starts at the third.”
VISIBLE INPUTS

model state

path count

seed

CALIBRATION

Simulation parameters inherit the calibrated model; path count controls numerical precision, not fit.

RISK

sampling error

tail under-sampling

DAILY WORKFLOW
  1. Validate market state and timestamp
  2. Recompute the baseline
  3. Run a controlled perturbation
  4. Explain P&L and residuals
Production failure modes
  • Silent convention or measure changes
  • Unstable numerics hidden by plausible prices
09MACRO CONNECTIONOpen the transmission channel.
MACRO CONNECTION

Transmission from state to valuation

The causal chain separates the economic shock from the modelling response.

01Model lawtransmits

defines scenarios

02Path enginetransmits

samples payoffs

03Error baroutput

governs numerical confidence

10COMMON PITFALLSOpen the failure checklist.
01

Reporting only the mean

02

Changing seed during regression tests

11SOURCES / FURTHER READINGOpen sources and continue the track.
research

Measure theory, simulation and computational-finance lectures

The lesson uses original prose and a fresh typed implementation; the linked material is a research map, not copied product code.

Source
Computational Finance Course
Author
L. A. Grzelak
Ref
main
OPEN ORIGINAL SOURCE ↗