In this community wiki page a twice-upvoted comment asserted by @probabilityislogic asserted that "Multi-level modelling is definitely easier for bayesian, especially conceptually." Is that true, and if so/not why?


2 Answers 2


I agree with Matthew. I'd like to add two observations.

There are several ways to write a multilevel model, but the main alternatives are the leveled and combined forms. As you know, you can write a simple multilevel model as: $$\begin{align}\text{Level-1}:\, y_i=&\beta_{0j[i]}+\beta_{1j[i]}x_i+\varepsilon_i \\ \text{Level-2}:\qquad &\beta_{0j}=\gamma^0_0+\gamma^0_1w_j+\eta^0_j \\ &\beta_{1j}=\gamma^1_0+\gamma^1_1w_j+\eta^1_j \end{align}$$ or as: $$y_i=\gamma^0_0+\gamma^0_1w_{j[i]}+\gamma^1_0 x_n+\gamma^1_1 w_{j[i]}x_i +\eta^0_{j[i]}+\eta^1_jx_i+\varepsilon_i$$ In the first form, you model all the coefficients in the same way and writing a bayesian model in BUGS, JAGS or Stan is (almost) straightforward, and you can easily add a third level. When using mixed-effects sofware (PROC MIXED, lmer, etc.) you must remember that whenever you seek to predict a variation in a slope by second-level predictors, you have to include cross-level interaction terms (interactions between level-1 and level-2 predictors) in the fixed-effects part of your formula, and defining the random-effects part is only easy in trivial cases. This is why someone says that there is a strong formal relationships between multilevel modeling and Bayesian analysis (see Kreft and De Leeuw, Introducing Multilevel Modeling, Sage, 1998, §1.4.7).

However, I often use non-Bayesian tools to take a first look and to compare results. Moreover, I'd not say that using PROC MIXED or lmer is "wrong" or "outmoded"

The real issue is that one can't use frequentist methods when the number of level-2 units is small.

This has been highlighted by several authors, e.g. by Gelman and Hill, Data Analysis Using Regression and Multilevel/Hierachical Models, Cambridge University Press, 2007, §16.1 ("Why you should learn BUGS": "When the number of groups is small or the multilevel model is complicated [...] there just might not be enough information to estimate variance parameters precisely" by frequentist methods) or by Raudenbush and Bryk, Hierarchical Linear Models, Sage, 2002, Chap. 13 ("The number of higher-level units may be small and the data may be unbalanced. In these settings, there are distinct advantages in becoming fully Bayesian".)

A recent paper by Mark L. Bryan and Stephen P. Jenkins (Regression analysis of country effects using multilevel data: a cautionary tale, Institute for Social and Economic Research, WP2013-14) presents a Monte-Carlo simulation analysis that suggests that, in order to derive reliable estimates, users require at least 25 groups for linear models and at least 30 groups for logit models. One of their recommendations is "move beyond classical (frequentist) statistics and make greater use of Bayesian methods of estimation and inference, as they appear to perform better when there are few countries."

  • $\begingroup$ Your post appears to concentrate on the estimation of the parameters of a multi-level model via software. Can you say anything more regarding the argument that the idea of a multi-level model is conceptually easier from a Bayesian perspective? $\endgroup$
    – jsk
    Commented May 15, 2014 at 0:20
  • $\begingroup$ Matthew's answer expounds on this better than I could. If you wish additional reading references, you can look at Lindley and Smith, "Bayesian Estimates for the Linear Model", J. Roy. Statist. Soc. Ser. B, 34, 1-41, Smith, "A general Bayesian linear model", J. Roy. Statist. Soc. Ser. B, 35, 251-71, or Lehmann and Casella, Theory of Point Estimation, Springer, 1998, §4.5 about the hierarchical Bayes model. $\endgroup$
    – Sergio
    Commented May 15, 2014 at 5:24
  • $\begingroup$ Furthermore, frequentist methods include restricted maximum likelihood. As Laird and Ware say, "the Bayesian approach leads to the unified treatment of estimation and computation" (vague priors for fixed, i.e. population, effects. "Random-Effects Models for Longitudinal Data", Biometrics, 38, 963-974) They refer to Harville, "Bayesian Inference for Variance Components Using Only Error Contrasts", Biometrika, 61, 383-385. See also Searle, Casella and McCullohg, Variance Components, John Wiley & Sons, 1992, §8.3g "A Bayesian justification for REML". $\endgroup$
    – Sergio
    Commented May 15, 2014 at 6:42
  • $\begingroup$ @Sergio, why is the defining of the random effect part only easy in trivial cases? I thought the random effect is the 2nd stage models? $\endgroup$
    – Geoff
    Commented Aug 16, 2023 at 16:49

Bayesian multilevel models are conceptually pleasing because the hierarchical structure of the parameters is built into the prior specification. Consider test score $y_{ij}$ for student $i$ who attends school $j$. We want to learn about the school-specific test score parameters $\theta_j$, so, because we want to use Bayesian methods, we will set a prior distribution for each $\theta_j$. However, this is going to be a multilevel model, so we want/expect school-specific parameters $\{\theta_j\}$ to be similar and/or want to share information across school. To model this, we assign the same prior to each school parameter and then put a prior on this hyperparameter. This gives $$ y_{ij} \mid \theta_j \sim \pi_1(\theta_j) \text{ for $i \in \text{school}_j$} \\ \theta_j \mid \phi \sim \pi_2(\phi) \\ \phi \sim \pi_3(), $$

where $\{\pi_1, \pi_2, \pi_3 \}$ are the relevant distributions. In the posterior for this prior specification and data likelihood, the overall parameter $\phi$ will be informed by each $\theta_j$, which are informed by the scores within each relevant school. So $\phi$ gives us a nice overall distribution to study. But $\theta_j$ is also informed by $\phi$ through the prior, so we are sharing information across schools to better inform us in cases where there is a small amount of data. All of this is done through the prior-posterior connection, so it's very natural in the Bayesian paradigm.

Further, there is no limit on the depth of your prior specification. If schools are within districts which are within provinces which are within countries you could theoretically add three more levels to this prior specification. Every new level to the model corresponds to another prior being specified. In this sense multilevel models are very comfortable in Bayesian analyses.

In terms of computational ease, if conjugate priors are chosen throughout it's possible to work out this multilevel model without doing anything more than Gibbs sampling in most cases.

  • 3
    $\begingroup$ Could you also explain why a Frequentist multi-level model is not as straightforward conceptually? $\endgroup$
    – jsk
    Commented May 14, 2014 at 18:54
  • 1
    $\begingroup$ @jsk Sergio's answer expounds on this better than I could. $\endgroup$
    – user44764
    Commented May 14, 2014 at 22:19

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.