# Looking for examples from the MCMC family of ideas

I am teaching a "computation" course, where we get students to explore mathematics and statistics via a high-level programming language. So the course is less about mathematics proper, and more about computation, and the process of learning about mathematics.

I am looking for good examples of the form where the main ideas behind the techniques are easy to motivate, and yet the technique (aided with a computer) produces otherwise difficult-to-obtain results.

I've been hoping to find a good example from the MCMC family of ideas. Perhaps it's because I'm not terribly familiar with this branch of stats myself that I haven't developed good basic examples.

Perhaps this is a stretch, but in these family of ideas would there be a good, simple way of estimating the volume of an icosahedron?

I don't need examples quite that sophisticated. But I would like the examples to be intuitive-enough to stand on their own, but flexible enough so the student could have some idea of how to apply the technique to a wide variety of problems.

These students know linear algebra and multi-variable calculus, and a little bit about programming languages.

• MCMC stands for Markov Chain Monte Carlo. Jan 3 '17 at 22:50

Perhaps the "Metropolis Ball-Walk" algorithm for computing the volume of a polyhedron might be a good example? I found two sets of lecture notes on the topic, neither of which may be ideal, but...

The snapshot above is from Sinclair's notes.

• Thanks Joseph. I'll see what I can do with this. . . Jan 4 '17 at 3:49

To sample a point uniformly inside a convex set (e.g. to evaluate an integral, for example if you want to know the average distance from the center in your icosahedron), to my knowledge the most efficient algorithm is the "hit-and-run": from a point in the convex, you take a uniform random direction (easily constructed from a radially symmetric Gaussian random vector), draw the maximal segment in the convex generated by the current location and the drawn direction, a jump to a uniform random point on that segment. Then you iterate.

• Some literature references on hit-and-run can be found in a paper by Anderson & Diaconis: PDF download. Jan 5 '17 at 13:43