ABSTRACT

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

(X1 + · · ·+Xn) = X¯n,

Var(X) ≈ 1 n− 1

(Xj − X¯n)2.