Appendix A — Stata for Cross Sectional Multilevel Models

model equation Stata English
Intercept Only \(y = \beta_0 + e_{ij}\) mixed y We estimated the mean of [outcome]
Intercept, Independent Variable(s) \(y = \beta_0 + \beta_1 x + \beta_2 z + e_{ij}\) mixed y x z We estimated the relationship of [independent variable(s)] with [outcome]
Intercept, Random variation of the intercept \(y = \beta_0 + e_{ij} + u_{0j}\) mixed y || groupid: We estimated the mean of [outcome]. We allowed the intercept of the model to vary by [groupid].
Unconditional intraclass correlation coefficient (ICC) \(\frac{var(u_{0j})}{var(u_{0j}) + var(e_{ij})}\) mixed y || groupid: then estat icc XX% of the variation in [outcome] was explained by clustering of participants in [groupid]
Intercept, Independent variable(s), Random variation of the intercept \(y = \beta_0 + \beta_1 x + \beta_2 z + e_{ij} + u_{0j}\) mixed y x z || groupid: We estimated the relationship of [independent variable(s)] with [outcome]. We allowed the intercept of the model to vary by group.
Intercept, Independent variable, Random intercept, Random slope \(y = \beta_0 + \beta_1 x + e_{ij} + u_{0j} + u_{1j} x\) mixed y x || groupid: x We estimated the relationship of [independent variable] with [outcome]. We allowed the intercept of the model to vary by group. We also allowed the relationship of [independent variable] with [outcome] to vary by group.
We can estimate multilevel models with more than 1 random slope. \(y = \beta_0 + \beta_1 x + \beta_2 z +\) \(e_{ij} + u_{0j} + u_{1j} x + u_{2j} z\) mixed y x z || groupid: x z