Chapter 12

Markov chain Monte Carlo

We have seen throughout this book that simulation is a powerful technique in probability. If you can’t convince your friend that it is a good idea to switch doors in the Monty Hall problem, in one second you can simulate playing the game a few thousand times and your friend will just see that switching succeeds about 2/3 of the time. If you’re unsure how to calculate the mean and variance of an r.v. X but you know how to generate i.i.d. draws X1, X2, ... , Xn from that distribution, you can approximate the true mean and true variance using the sample mean and sample variance of the simulated draws:

E(X) ≈ 1 n ( X 1 +⋯+ X n ) =  X ¯ n , Var(X) ≈ 1 n−1 ∑ j=1 n

Get Introduction to Probability now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.