Examples#
This gallery walks through every public feature of
financialkit.monte_carlo: crude Monte Carlo with error bars, variance
reduction, quasi-Monte Carlo, Monte Carlo Greeks and multilevel Monte
Carlo. Each script illustrates one dated breakthrough from the
history page.
See also the narrative tutorial:
Each script in this gallery is self-contained and can be run directly with
python examples/monte_carlo/<section>/<script>.py.
Sections#
basics – the Monte Carlo method of Metropolis and Ulam, Box-Muller normal variates and Boyle’s option prices.
variance_reduction – Neyman stratification, importance sampling, antithetic variates, Latin hypercube sampling, control variates and moment matching.
quasi_monte_carlo – Halton and Sobol sequences, the Koksma-Hlawka inequality, Owen scrambling, Paskov-Traub’s high-dimensional integrals and the Brownian bridge.
greeks – likelihood-ratio and pathwise Greeks.
multilevel – Giles’s multilevel Monte Carlo.
Crude Monte Carlo#
Expectations as sample means with standard errors and confidence intervals, normal variates from uniforms, and option prices by simulation.
Monte Carlo Greeks#
Sensitivities without bump-and-reprice: the likelihood-ratio and pathwise estimators, checked against the Black-Scholes Greeks.
Multilevel Monte Carlo#
Giles’s telescoping sum over Euler discretisations of increasing resolution, and its cost against standard Monte Carlo.
Quasi-Monte Carlo#
Low-discrepancy points instead of random ones: Halton and Sobol sequences, the Koksma-Hlawka error bound, randomized QMC with error bars, and high-dimensional path integrals with and without the Brownian bridge.
Variance reduction#
The same expectation from fewer samples: stratification, importance sampling, antithetic variates, Latin hypercubes, control variates and moment matching, each compared with crude Monte Carlo.