Welcome.

The goal of this online supplement is to provide a complete worked example of the implementation of a Metropolis-Hastings within Gibbs sampler for a two parameter logistic (2PL) item response theory (IRT) model in R.

My approach is to mimic the steps that I went through when I wrote the sampler for the chapter. My hope is that by doing so, I will make it easier to follow along at home. I have attempted to make these pages relatively self-contained. That said, it would likely be helpful if you read the chapter first.

I have broken up the content into separate posts:

**Getting started with R**

**Building your first sampler**

- Post 1: A Bayesian 2PL model
- Post 2: Generating fake data
- Post 3: Setting up the sampler and visualizing its output
- Post 4: Sampling the person ability parameters
- Post 5: Refactoring Part I: a generic Metropolis-Hastings sampler
- Post 6: Refactoring Part II: a generic proposal function
- Post 7: Sampling the item parameters with generic functions
- Post 8: Sampling the variance of person ability with a Gibbs step
- Post 9: Tuning the complete sampler

**Improving the sampler's performance (Coming soon)**

- Post 10: Over dispersion and multi-core parallelism
- Post 11: Replacing R with C
- Post 12: Adaptive tuning of the Metropolis-Hastings proposals

**Miscellany (Coming later)**

- Post 13: Optimizing your computer for R.

I chose to implement this supplement as a blog because it seemed like a good way to communicate with the people who use it. Please feel free to leave a comment on any of the posts. Thanks.