If you don’t use R to fit multilevel models, there’s no point in reading this one

David Afshartous writes,

What is the difference between sim() and mcsamp(), if any? If there is a difference, what should I expect in terms of difference in results?

My reply:

sim() is a simple function that I wrote to draw from the posterior distribution of a linear regression model, or the approximate normal posterior distribution of a generalized linear model, or the approximate normal posterior distribution of a multilevel model, conditional on the group-level variances in that case.

mcsamp() is a crossover function: it takes mcmcsamp(), a function from the Doug Bates universe, and ports it over to the Gelman universe: mcsamp() is part of the “arm” package and is set up so that print() and plot() look nice (in the form of printing and plotting bugs() objects) and it monitors convergence. mcmcsamp() can’t do much by itself; the front-end provided by mcsamp() makes it more of an applied tool.

I didn’t write mcmcsamp() and don’t know exactly how it works; however, Yu-Sung has tried it out and found that it gives reasonable results, so I’d recommend using it and not using sim(). See point 2 here.

Actually, we should link mcsamp() as part of sim() to work with classical regressions and glms also, so that all simulations can be extracted in a consistent way.