Statistics & Analysis

Hierarchical Linear Modeling (HLM)

Definition

Hierarchical Linear Modeling (HLM), also called multilevel modeling or mixed effects modeling, is a statistical method for analyzing data that have a nested or hierarchical structure, such as students within classrooms, patients within hospitals, or repeated measurements within individuals. HLM explicitly models the variability at each level of the hierarchy, producing more accurate standard errors and allowing the analyst to examine how variables at different levels influence the outcome.

Why it matters

Nested data structures are ubiquitous in health, education, organizational, and social research. Students are grouped within classrooms and schools. Patients are treated within clinics and health systems. Survey respondents live within neighborhoods and regions. When observations within the same group are more similar to each other than to observations in other groups (which is usually the case), standard regression methods that treat all observations as independent produce incorrect standard errors (usually too small) and inflated Type I error rates. HLM addresses this problem by explicitly modeling the clustering, producing accurate inferences and enabling researchers to answer questions that single level analyses cannot address. For example, HLM can show how much of the variation in student achievement lies between students and between schools, whether student level factors (aptitude, motivation) or school level factors (resources, teaching quality) are associated with it, and whether the effect of student level factors varies across schools.

How it works

HLM specifies a model at each level of the hierarchy. In a two level model (for example, students within schools), the Level 1 model describes the relationship between the outcome and student level predictors within each school. The Level 2 model describes how the Level 1 intercepts and slopes vary across schools and how school level predictors explain that variation.

For example, if the outcome is math achievement, the Level 1 model might include student socioeconomic status (SES) as a predictor. With SES grand mean centered, the Level 1 intercept represents each school's mean math achievement adjusted for SES, and the Level 1 slope represents the effect of SES on math achievement within each school. The Level 2 model might include school funding level as a predictor of the school level intercepts (testing whether better funded schools have higher mean achievement) and as a predictor of the SES slopes (testing whether the SES achievement gap is smaller in better funded schools). This latter question is a cross level interaction and is one of the most powerful features of HLM.

The model includes fixed effects (the average intercept and slopes across all groups) and random effects (the deviations of each group's intercept and slopes from the averages). The random effects are assumed to follow a multivariate normal distribution, and their variance and covariance are estimated by the model. Estimation typically uses maximum likelihood (ML) or restricted maximum likelihood (REML).

HLM extends naturally to three or more levels (students within classrooms within schools within districts), to cross classified structures (students who change schools, patients treated by multiple providers), and to non normal outcomes (binary, count, or ordinal outcomes through generalized linear mixed models).

For longitudinal data, HLM treats repeated measurements as Level 1 units nested within individuals at Level 2. This framework naturally handles unequal spacing of measurements, missing data at some time points (under the missing at random assumption), and individual variation in growth trajectories.

When to use it

HLM should be considered whenever the data have a nested structure and ignoring the clustering would produce incorrect inferences. Common applications include education research (students in classrooms in schools), health services research (patients in hospitals), organizational research (employees in teams in companies), longitudinal studies (measurements within individuals), and survey research with complex sampling designs (respondents within sampling units). It is also used in meta analysis (for example, several effect sizes nested within the same study) and for analyzing multi site clinical trials.

Key takeaways

  • Nested data structures are ubiquitous in health, education, organizational, and social research.
  • In a two level model (for example, students within schools), the Level 1 model describes the relationship between the outcome and student level predictors within each school.
  • HLM should be considered whenever the data have a nested structure and ignoring the clustering would produce incorrect inferences.
  • A common error is ignoring the hierarchical structure and using ordinary regression, which usually produces standard errors that are too small and p values that are too liberal.

Common mistakes

A common error is ignoring the hierarchical structure and using ordinary regression, which usually produces standard errors that are too small and p values that are too liberal. Another mistake is including too many random effects for the number of groups, leading to estimation problems (non convergence, singular covariance matrices). A general guideline is that at least 20 to 30 groups are needed for reliable estimation of random effects, and each additional random slope requires additional groups. Centering decisions (group mean centering versus grand mean centering for Level 1 predictors) affect the interpretation of coefficients, and failing to choose centering deliberately can produce uninterpretable results. Some researchers report only the fixed effects from an HLM without reporting the random effects (variances and covariances), which removes essential information about between group variability. Finally, misinterpreting cross level interactions (or failing to test them when they are theoretically important) limits the value of the multilevel approach.

Example

An education researcher examines math achievement among 8,000 students in 120 schools. The two level HLM reveals that the average math score (the fixed intercept) is 68.4 points (SE = 1.2). Student SES has a positive fixed effect (slope = 3.2 points per unit SES, p less than 0.001), but the random slope variance is significant (variance = 4.8, p = 0.003), indicating that the SES effect varies across schools. A cross level interaction shows that schools with more experienced teachers have a smaller SES gap (interaction coefficient = minus 0.8, p = 0.01), meaning that teacher experience moderates the relationship between student SES and achievement. The intraclass correlation coefficient (ICC) at the school level, from the model with no predictors, is 0.15, indicating that 15% of the total variance in math achievement lies between schools.

Sources

  1. [1]Field A. Discovering Statistics Using IBM SPSS Statistics. 6th ed. SAGE Publications, 2024.
  2. [2]Raudenbush SW, Bryk AS. Hierarchical Linear Models: Applications and Data Analysis Methods. 2nd ed. Thousand Oaks, CA: Sage Publications; 2002.
  3. [3]Hox JJ, Moerbeek M, van de Schoot R. Multilevel Analysis: Techniques and Applications. 3rd ed. Routledge, 2017.

Cite this term

FullHierarchical Linear Modeling (HLM). Paperguide Research Glossary. Paperguide, 2026. Available at: https://paperguide.ai/research-glossary/hierarchical-linear-modeling-hlm/
In-text(Paperguide, 2026)

Related terms