I've been recently learning about mixed effects models (e.g. via Fitzmaurice, Laird, and Ware 's book Applied Longitudinal Analysis) as well as Bayesian hierarchical models (e.g. via Gelman and Hill's book Data Analysis Using Regression and Multilevel/Hierarchical Models)

One curious thing I've noticed: The Bayesian literature tends to emphasize that their models can handle covariates at multiple level of analysis. For example, if the clustering is by person, and each person is measured in multiple "trials," then the Bayesian hierarchical models can investigate the main effects of covariates both at the subject and trial level, as well as interactions across "levels."

However, I have not seen these kinds of models in the textbooks introducing frequentist methods.

I'm not sure if this is a coincidence, or an example of where Bayesian methods can do "more complicated things." Is it possible to use mixed effects models (e.g. the lme4 or nlme packages in the R statistical software) to investigate interactions of covariates across "levels" of analysis?


2 Answers 2


Yes it is. I don't know the commands in R but in SAS PROC MIXED you can have variables at either level in the MODEL statement and you can include interactions. e.g., a split plot design

proc mixed;
   class A B Block;
   model Y = A B A*B;
   random Block A*Block;

where A is assigned to whole plots and B is assigned to subplots.

  • 2
    $\begingroup$ The R commands are either lme() or lmer(). Both are mixed effects models. lmer() is newer and preferred, although lme() seems to work fine for most applications. Pinheiro and Bates - Mixed Effects Models in S and S-Plus covers both the theory and applications of these models in R pretty well. $\endgroup$
    – Nate
    Commented Sep 4, 2013 at 12:12

If we define levels differently, mixed models may not be able to do what Bayesian models can. The other alternative is structural equation modeling.

For e.g When variables A,B drive C. Variables A,B,C,D, drive E.

You have equation : E = oA + pB + qC + rD + z ;
C = mA + nB + k ;

where all small letters are parameter estimates/error terms k,z

Mixed models cant be used in this case since the errors z,k could be correlated. Thereby, we have to resort to hierarchical Bayesian models or structural equation models.


  • $\begingroup$ Is this supposed to be an answer or a question? Moreover, here are a couple of thoughts: mixed models can be thought of as a limited version of SEM, & I'm not sure you couldn't satisfactorily deal w/ your situation w/ a hierarchical model. $\endgroup$ Commented Oct 19, 2013 at 3:12
  • $\begingroup$ I'm getting used to this place. it is an answer - highlighting what Bayesian can do which mixed cant. Yes, mixed is a limited version of SEM. (@gung, second statement- I didn't understand) $\endgroup$ Commented Oct 19, 2013 at 3:15
  • $\begingroup$ I think this is wrong. Anything Bayesian is just a fancy version of likelihood. If likelihood fails, Bayesian fails. If correlation between errors leads to biased frequentist estimates, no amount of Bayesian computational trickery will rectify that. On the other hand, Bayesian versions of instrumental variables that can deal with correlated measurement error issues are difficult to set up, unless you want to do non-parametric modeling of the error term distribution. $\endgroup$
    – StasK
    Commented Oct 19, 2013 at 15:52
  • $\begingroup$ Interesting point @StasK. Have never thought of correlating prediction errors in a Bayesian hierarchical model. But, am not sure if it's right - to correlate residuals determined by the Bayesian approach and determine if error correlation exists. $\endgroup$ Commented Oct 20, 2013 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.