Hierarchical Linear Model (HLM)

Statistics
Introduced by
Bryk & Raudenbush
Year
1992
Type
Multilevel linear regression
Family
Regression / GLM

What does it do?

The Hierarchical Linear Model (HLM) is a multilevel regression method for data in which lower-level units (e.g., students, patients) are nested within higher-level groups (e.g., schools, hospitals).

It models within-group relationships and between-group variation within a single framework. Ordinary regression assumes independent observations, whereas HLM produces standard errors that account for the clustering created by the nested structure.

The intuition behind the method

Standard regression treats every observation as independent, but when students share a classroom their outcomes are correlated, and ignoring that correlation inflates confidence and misleads inference. HLM fits a separate within-group regression for each cluster and then treats the cluster-level intercepts and slopes as outcomes of a second-level model, so group characteristics can explain why relationships vary across groups. The result is one model that respects the nested structure, shrinks unstable group estimates toward the overall average (partial pooling), and partitions variation into within-group and between-group components.

History

The modern framework for hierarchical linear models is associated with Bryk and Raudenbush, with the originating work dated to 1992. The second edition of their book (2002) is cited on this page.

When to use it

Use HLM when observations are nested within groups, the outcome is continuous, and the data show non-trivial intraclass correlation. An ICC above about 0.05 is an informal screen rather than a decision rule; the choice should rest on a formal test (see the FAQ). Typical cases include students in schools, employees in organisations, patients in clinics, and repeated measures within individuals. HLM is also the natural choice when you want cross-level interactions, for example whether a student-level effect varies with school policy. Be cautious when observations are essentially independent (ICC close to zero), when there are few groups at the highest level (see the FAQ on group numbers), or when groups are very small, since variance components then become unreliable. For binary or count outcomes, a generalised linear mixed model is needed instead.

Limitations and considerations

  • Requires enough units at every level. Practitioner guidance often suggests about 20–30 higher-level units, but this is an informal guideline: stability also depends on group sizes and on the number of random slopes, so convergence and the precision of the variance components should be checked rather than assumed.
  • More complex to specify, estimate, and interpret than standard OLS, especially when random slopes are included.
  • Variance-component estimates can be biased or fail to converge when the model is over-specified relative to the data.
  • Assumes normality of random effects; serious departures can distort variance estimates and shrinkage.
  • Does not handle non-continuous outcomes directly — logistic or Poisson variants (GLMM) are needed for binary or count outcomes.
  • Relies on regression-type assumptions at each level: linear relationships between predictors and outcome, Level-1 residuals that are independent with constant variance, normally distributed Level-2 random effects, and a correctly specified random-effect structure. Level-1 predictors that are correlated with the random intercept or slopes can bias the estimates that depend on them, which matters especially for cross-level inference.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Correctly accounts for non-independence of observations within clusters, yielding valid standard errors and p-values.
  • Partitions variance into within-group and between-group components, revealing how much context matters.
  • Models cross-level interactions: how group-level variables moderate individual-level relationships.
  • Borrows statistical strength across groups through partial pooling, stabilising estimates for small or sparse groups.
  • Handles unbalanced group sizes and missing data at the individual level naturally within the ML/REML framework.

Applications

  • Educational research: modelling student achievement as a function of both student-level and school-level predictors simultaneously.
  • Organisational behaviour: examining how employee outcomes depend on individual traits and team or firm characteristics.
  • Clinical trials with patients clustered in hospitals or therapists, ensuring shared therapist effects are properly accounted for.
  • Longitudinal data analysis: treating repeated measurements as Level-1 units nested within individuals at Level 2.
  • Cross-national survey research: modelling individual attitudes while accounting for country-level cultural or institutional factors.
  • Health disparities research: partitioning health outcomes into individual-level risk factors and neighbourhood-level contextual effects.
  • Housing economics: a hedonic price study of 76,343 homes in four California counties, with homes nested in neighbourhoods and communities, modelled sale prices with a three-level random-parameters model that extends the same logic (Beron, Murdoch and Thayer, 1999, as presented in the cited textbook).

How it works

How it works

1

The Level-1 equation models the individual outcome y for person i in group j as a linear function of individual predictors x, with group-specific intercept β₀ⱼ and slope β₁ⱼ, plus an individual-level residual r.

Formula
y_{ij} = \beta_{0j} + \beta_{1j}x_{ij} + r_{ij}
2

The Level-2 equations model the group-varying coefficients from Level 1 as functions of group-level predictors w and random group effects u, decomposing each coefficient into a fixed part (γ) and a random deviation.

Formula
\beta_{0j} = \gamma_{00} + \gamma_{01}w_j + u_{0j},\quad \beta_{1j} = \gamma_{10} + \gamma_{11}w_j + u_{1j}
3

The random effects u across groups are assumed to follow a multivariate normal distribution with covariance matrix τ, capturing how much intercepts and slopes vary across groups.

Formula
\begin{pmatrix}u_{0j}\\u_{1j}\end{pmatrix}\sim \mathcal{N}\left(\mathbf{0},\,\boldsymbol{\tau}\right)
4

Parameters are estimated by restricted maximum likelihood (REML) or full maximum likelihood (ML). REML is generally preferred for estimating variance components, since it yields less biased variance estimates than ML. ML is needed when comparing models that differ in their fixed-effect structure with a likelihood-ratio test, because REML likelihoods are not comparable across different fixed structures.

5

The intraclass correlation coefficient ρ = τ₀₀ / (τ₀₀ + σ²) quantifies what fraction of total outcome variance lies between groups. Here σ² is the Level-1 residual variance and τ₀₀ is the variance of the random intercept u₀ⱼ. The ICC is computed from the unconditional (null) model, which contains no predictors, so it describes clustering before any explanatory variables are added. When ρ is meaningfully greater than zero, observations within a group are correlated and a multilevel model is warranted.

Formula
\rho = \frac{\tau_{00}}{\tau_{00} + \sigma^2}

Common pitfalls

  • Running standard OLS on nested data: ignoring clustering underestimates standard errors, inflating Type I error rates, sometimes dramatically.
  • Including random slopes without checking whether the data support them — unnecessary random slopes consume degrees of freedom and cause convergence failures.
  • Interpreting a non-significant ICC as proof that HLM is unnecessary without testing it formally via a likelihood-ratio test comparing HLM to OLS.
  • Centring predictors incorrectly: group-mean versus grand-mean centring changes the interpretation of Level-1 slopes, and the choice must be theoretically justified.
  • Comparing nested models with REML rather than ML — likelihood-ratio tests of fixed effects require ML estimation.

Frequently asked questions

How many groups do I need to run HLM reliably?

Practitioner guidance often suggests about 20–30 higher-level units for stable variance-component estimates. This is an informal guideline rather than a requirement. With few groups the between-group variance estimate becomes unreliable, and its standard error can be substantially underestimated. Group size also matters: very small groups (fewer than 5 units) contribute little information about within-group slopes. Check convergence and the precision of the variance components in the fitted model.

What is the ICC and when does it justify HLM?

The intraclass correlation coefficient (ICC) is the proportion of total outcome variance attributable to group membership, computed from the null model with no predictors. An ICC above roughly 0.05 is an informal screen suggesting that clustering may matter, since ignoring clustering can inflate Type I error rates in standard regression. A formal likelihood-ratio test comparing the null HLM to OLS is more reliable than any fixed ICC threshold. Because the random-intercept variance is tested on the boundary of its parameter space, the usual chi-square reference distribution is conservative, and this should be kept in mind when interpreting the test.

Should I use REML or ML estimation?

Use REML when estimating variance components or making inferences about fixed effects in a final model, since REML produces less biased variance estimates. Switch to ML when comparing two models that differ only in their fixed effects using a likelihood-ratio test, because REML likelihoods are not comparable across models with different fixed structures.

What is group-mean versus grand-mean centring and why does it matter?

Grand-mean centring subtracts the overall predictor mean, leaving within- and between-group effects confounded in the Level-1 slope. Group-mean centring subtracts each group's own mean, isolating the pure within-group effect. The choice changes what the slope estimates and must be driven by the research question.

Can HLM be extended to non-continuous outcomes?

Yes. Generalised linear mixed models (GLMMs) extend HLM to binary outcomes (multilevel logistic regression), count outcomes (multilevel Poisson or negative binomial), ordinal outcomes, and survival data. The random-effects logic and estimation approach follow the same principles as standard HLM.

Related methods

Sources

  1. Raudenbush, S. W., & Bryk, A. S. (2002). Hierarchical Linear Models: Applications and Data Analysis Methods (2nd ed.). Sage Publications.

    ISBN: 978-0761919049
  2. Snijders, T. A. B., & Bosker, R. J. (2012). Multilevel Analysis: An Introduction to Basic and Advanced Multilevel Modeling (2nd ed.). Sage Publications.

    ISBN: 978-1849202015
  3. Econometric Analysis, 7th Edition, Example 15.14, p. ?