# Designing simulation studies using R

Here are the slides from my presentation at this afternoon’s Quant. Methods brown bag. I gave a very quick introduction to using R for conducting simulation studies. I hope it was enough to get people intrigued about the possibilities of using R in their own work.

The second half of the presentation sketched out a quick-and-dirty simulation of the Behrens-Fisher problem, or more specifically the coverage rates of 95% confidence intervals using Welch’s degrees of freedom approximation, given independent samples with unequal variances. Here is the complete code. As I mentioned in the talk, there’s lots of room for improvement. The main point that I was trying to illustrate is that simulations have five distinct pieces:

- a data generating model,
- an estimation procedure,
- performance criteria,
- an experimental design (parameter values and sample dimensions), and
- analysis and results.

It is useful to write simulation code that reflects the structure, so that it is easy for you (or other people) to read, revise, extend, or re-run it. And then post it on your blog.