grad-hlm

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

階層線性模型 (Hierarchical Linear Modeling)

分层线性模型 (Hierarchical Linear Modeling)

Overview

概述

Hierarchical Linear Modeling (HLM), also called multilevel modeling, accounts for the nested structure of data where lower-level units (e.g., students, employees) are clustered within higher-level units (e.g., schools, firms). By partitioning variance into within-group and between-group components and allowing intercepts and slopes to vary randomly, HLM produces unbiased estimates and correct standard errors.
分层线性模型(Hierarchical Linear Modeling, HLM)又称多水平模型,用于处理数据的嵌套结构——即低层级单元(如学生、员工)聚集在高层级单元(如学校、企业)中。通过将方差划分为组内和组间成分,并允许截距和斜率随机变化,HLM能够生成无偏估计值和正确的标准误。

When to Use

适用场景

  • Data has a hierarchical or nested structure (individuals within groups)
  • Intra-class correlation (ICC) is non-trivial (rule of thumb: ICC > 0.05)
  • Research questions involve cross-level interactions (group-level moderators of individual-level effects)
  • Repeated measures or longitudinal data nested within subjects (growth models)
  • 数据具有分层或嵌套结构(个体隶属于组)
  • 组内相关性(ICC)显著(经验法则:ICC > 0.05)
  • 研究问题涉及跨层级交互作用(组层面变量调节个体层面效应)
  • 受试者内的重复测量或纵向数据(增长模型)

When NOT to Use

不适用场景

  • Data are not nested or clustering is negligible (ICC near zero)
  • Number of groups is very small (fewer than 20 Level-2 units)
  • Interest is purely in fixed effects with no group-level predictors
  • The nesting structure is crossed, not hierarchical (use crossed random effects instead)
  • 数据无嵌套结构或聚类可忽略(ICC接近0)
  • 组数量极少(第二层级单元少于20个)
  • 仅关注固定效应且无组层面预测变量
  • 嵌套结构为交叉而非分层(应使用交叉随机效应模型)

Assumptions

假设

IRON LAW: Ignoring nested structure when ICC is non-trivial produces
UNDERESTIMATED standard errors — leading to inflated Type I error rates.
OLS treats clustered observations as independent, overstating precision.
Key assumptions:
  1. Level-1 residuals are normally distributed with constant variance within groups
  2. Random effects (intercepts, slopes) are normally distributed across groups
  3. Random effects are independent of Level-1 and Level-2 predictors (unless modeled)
  4. Sufficient number of Level-2 units for stable variance component estimation
IRON LAW: Ignoring nested structure when ICC is non-trivial produces
UNDERESTIMATED standard errors — leading to inflated Type I error rates.
OLS treats clustered observations as independent, overstating precision.
核心假设:
  1. 第一层级残差服从正态分布,且组内方差恒定
  2. 随机效应(截距、斜率)在组间服从正态分布
  3. 随机效应与第一、第二层级预测变量相互独立(除非已纳入模型)
  4. 拥有足够数量的第二层级单元,以稳定估计方差成分

Methodology

方法步骤

Step 1 — Estimate the Null Model (Unconditional)

步骤1 —— 估计零模型(无条件模型)

Run an intercept-only model to compute ICC = τ₀₀ / (τ₀₀ + σ²). This tells you what proportion of total variance lies between groups. If ICC is near zero, HLM may be unnecessary.
运行仅含截距的模型,计算ICC = τ₀₀ / (τ₀₀ + σ²)。该值表示总方差中组间方差的占比。若ICC接近0,则可能无需使用HLM。

Step 2 — Add Level-1 Predictors (Random Intercept Model)

步骤2 —— 添加第一层级预测变量(随机截距模型)

Include individual-level predictors with a random intercept. Group-mean center Level-1 predictors if the research question distinguishes within-group from between-group effects. See
references/
for centering decisions and equations.
纳入带有随机截距的个体层面预测变量。若研究问题需要区分组内与组间效应,需对第一层级预测变量进行组均值中心化。中心化决策及相关公式可参考
references/
目录。

Step 3 — Add Level-2 Predictors and Cross-Level Interactions

步骤3 —— 添加第二层级预测变量与跨层级交互项

Include group-level predictors to explain between-group variance in intercepts. Add cross-level interactions to test whether group characteristics moderate individual-level slopes. Allow slopes to vary randomly if theoretically justified.
纳入组层面预测变量以解释截距的组间方差。添加跨层级交互项以检验组特征是否调节个体层面的斜率。若有理论依据,可允许斜率随机变化。

Step 4 — Evaluate Model and Report

步骤4 —— 评估模型并报告结果

Compare models using deviance (-2LL), AIC, BIC. Report fixed effects with robust standard errors, variance components, and proportion of variance explained at each level.
使用偏差(-2LL)、AIC、BIC比较模型。报告带有稳健标准误的固定效应、方差成分,以及各层级的方差解释比例。

Output Format

输出格式

markdown
undefined
markdown
undefined

HLM Analysis: [Study Title]

HLM分析: [研究标题]

Data Structure

数据结构

LevelUnitN
Level 1[individual]xxx
Level 2[group]xxx
层级单元N
Level 1[individual]xxx
Level 2[group]xxx

ICC (Null Model)

ICC (零模型)

  • ICC = x.xx (x% of variance is between groups)
  • ICC = x.xx (x% of variance is between groups)

Fixed Effects

固定效应

PredictorLevelγS.E.tp-value
Interceptx.xxx.xxx.xxx.xx
[L1 var]1x.xxx.xxx.xxx.xx
[L2 var]2x.xxx.xxx.xxx.xx
[Cross-level]1×2x.xxx.xxx.xxx.xx
PredictorLevelγS.E.tp-value
Interceptx.xxx.xxx.xxx.xx
[L1 var]1x.xxx.xxx.xxx.xx
[L2 var]2x.xxx.xxx.xxx.xx
[Cross-level]1×2x.xxx.xxx.xxx.xx

Random Effects

随机效应

ComponentVarianceSDp-value
Intercept (τ₀₀)x.xxx.xxx.xx
Slope (τ₁₁)x.xxx.xxx.xx
Residual (σ²)x.xxx.xx
ComponentVarianceSDp-value
Intercept (τ₀₀)x.xxx.xxx.xx
Slope (τ₁₁)x.xxx.xxx.xx
Residual (σ²)x.xxx.xx

Model Comparison

模型比较

Model-2LLAICParametersΔ deviance (p)
Nullx.xxx.xxx
Finalx.xxx.xxxx.xx (x.xx)
Model-2LLAICParametersΔ deviance (p)
Nullx.xxx.xxx
Finalx.xxx.xxxx.xx (x.xx)

Limitations

Limitations

  • [Note any assumption violations]
undefined
  • [Note any assumption violations]
undefined

Gotchas

注意事项

  • Grand-mean centering and group-mean centering answer fundamentally different research questions
  • Too few Level-2 units (< 20) yields biased variance component estimates
  • Adding random slopes without theoretical justification can cause non-convergence
  • Pseudo-R² at Level 2 can be negative if adding Level-1 predictors redistributes variance
  • Ignoring Level-3 nesting (students in classrooms in schools) when it exists biases Level-2 estimates
  • Multicollinearity between Level-1 and Level-2 predictors inflates standard errors of cross-level interactions
  • 总均值中心化和组均值中心化对应完全不同的研究问题
  • 第二层级单元过少(< 20)会导致方差成分估计偏差
  • 无理论依据地添加随机斜率可能导致模型不收敛
  • 若添加第一层级预测变量后方差重新分布,第二层级的伪R²可能为负值
  • 若存在第三层级嵌套(学生在班级在学校)却被忽略,会导致第二层级估计偏差
  • 第一层级与第二层级预测变量间的多重共线性会增大跨层级交互项的标准误

References

参考文献

  • Raudenbush, S. W., & Bryk, A. S. (2002). Hierarchical Linear Models (2nd ed.). Sage.
  • Hox, J. J., Moerbeek, M., & van de Schoot, R. (2018). Multilevel Analysis (3rd ed.). Routledge.
  • Snijders, T. A. B., & Bosker, R. J. (2012). Multilevel Analysis (2nd ed.). Sage.
  • Raudenbush, S. W., & Bryk, A. S. (2002). Hierarchical Linear Models (2nd ed.). Sage.
  • Hox, J. J., Moerbeek, M., & van de Schoot, R. (2018). Multilevel Analysis (3rd ed.). Routledge.
  • Snijders, T. A. B., & Bosker, R. J. (2012). Multilevel Analysis (2nd ed.). Sage.