# Translate glmer (lme4) model specification into MCMCglmm

I am having some computational trouble estimating the following model with the glmer function in lme4:

glmer(Y ~ x1*x2 + x2*x3 + (1+x1+x2|class) + (1|obs), family=poisson)

• where class refers to my groupings,
• obs refers to observation (because I would like to an observation-level random effect).

I'd like to try the MCMCglmm package (without deep knowledge of MCMC unfortunately), but cannot figure out how to specify the random effects. So far, my draft command is:

MCMCglmm(fixed = Y ~ x1*x2 + x2*x3,
random = ~ class + x1:class + x2:class + obs, family="poisson")


In general you need to use a syntax similar to ~us(1+x1):x2, where x2 is your discrete variables (for the intercepts), x1 is your continuous variable (for the slopes) and us denotes an unstructured random covariance. You may want to check other covariance structures (eg. idh for an identity one). Please check the chapters 3 and 4 in dealing with Categorical Random Interactions and Continuous Random Interactions respectively in the related MCMCglmm Course Notes. The general overview document is also very helpful (and more concise). I cannot emphasise enough how helpful these notes are, using MCMCglmm without reading them would be nearly impossible for me.
I suspect you want a structure similar to: ~us(1+x1+x2):class + obs but please check this twice before using it. Note that a global intercept is not fitted by default for variance structure models so you need the +1 that was otherwise redundant for lmer.