# Introductory examples in computational statistics class

I'm looking for an example of Bayesian inference for a class with the properties:

1. The problem is easy to state, and the model & prior are both pretty reasonable, and
2. R can't really calculate the integral that shows up when you try to get the posterior distribution (either it gives an error, or it gives an answer that is very far off).

Bonus points if it is known that the integral in question really doesn't have a nice formula' in some sense (e.g. in the formalism introduced by the people who do differential Galois theory).

In case a reader is feeling especially kind, I'll say why I care about this:

I'll be teaching a computational statistics class next fall, and am looking for some tidy examples to give in the first 1-2 lectures that convey something about where problems in computational statistics come from and that they are somewhat unavoidable. I plan to have a moderate number of these (perhaps 5), and so I don't want any of them to require a lot of setup. Normally I don't worry so much about getting a 'hook' like this in the first class, but the first few weeks will otherwise be taken up with quite a bit of introductory material (intro to programming in R, then a review of notation, optimization, notions of complexity & basic computer science theory) and I worry that we won't get to any of the good stuff' before the shopping period is over.

The class is at the advanced undergrad/early grad level, and I'll be teaching out of Computational Statistics by Givens and Hoeting.

• Have you looked at Marin & Robert's Bayesian Core? – tchakravarty Apr 27 '15 at 13:26
• Also I would argue that Bayesian inference is not only for situations where other method "gives an error, or it gives an answer that is very far off". This kind of examples could give a wrong impression about when and why it is used. – Tim Apr 27 '15 at 13:32
• In response to Tim: I agree! However, the class I'm teaching (an introduction to computational statistics) really is only about situations in which the methods the students already know will not work very well. One big class of such problems comes from attempting to evaluate messy integrals, especially in high dimensions. In response to T C: I've ordered a copy but don't have it yet! – New_Dr Apr 27 '15 at 13:41
• Can you produce integral approximations in R for more than one dimension? even in dimension one, the use of the wrong scale for integrate(f,a,b) is enough to return a poor numerical value. – Xi'an Apr 27 '15 at 16:36
• @TC: Thanks! Actually, the new version of the book is called Bayesian Essentials with R! – Xi'an Apr 27 '15 at 20:13