心理学研究中经常使用回归,如混合线性模型(Mixed-Effects Models),来建模数据。研究举例:
年龄(Age, IV) 对 外倾性(Extraversion, DV) 的影响。
需要区分两个层面的变异:
set.seed(123)
n_subj <- 50
age <- rnorm(n_subj, mean = 20, sd = 10) # IV
# 假设构念由2个题目测量
# Item 1: 随年龄增长稍微增加 (Slope = 0.05)
# Item 2: 随年龄增长显著减少 (Slope = -0.05)
item1_scores <- 0.05 * age + rnorm(n_subj)
item2_scores <- -0.05 * age + rnorm(n_subj)
demo_data <- data.frame(
ID = rep(1:n_subj, 2),
Age = rep(age, 2),
Score = c(item1_scores, item2_scores),
Item = rep(c("Item 1 (温和社交)", "Item 2 (刺激社交)"), each = n_subj)
)
# 计算聚合分数 (Aggregation)
agg_data <- demo_data %>%
group_by(ID, Age, Item) %>%
summarise(Mean_Score = mean(Score))
# --- 统计检验 (ANOVA) ---
# 1. 传统聚合分析:检验 Age 主效应
# 逻辑:如果只看平均分,Age 有影响吗?
model_agg <- lm(Mean_Score ~ Age + Item, data = agg_data)
print(anova(model_agg))
Analysis of Variance Table
Response: Mean_Score
Df Sum Sq Mean Sq F value Pr(>F)
Age 1 0.00 0.000 0.0003 0.9861
Item 1 148.20 148.196 135.1612 <2e-16 ***
Residuals 97 106.35 1.096
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# 2. 交互作用分析:检验 Age × Item
# 逻辑:Age 对分数的影响,是否依赖于题目(Item)的不同?
model_inter <- lm(Score ~ Age * Item, data = demo_data)
print(anova(model_inter))
Analysis of Variance Table
Response: Score
Df Sum Sq Mean Sq F value Pr(>F)
Age 1 0.000 0.000 0.0004 0.9849
Item 1 148.196 148.196 161.5947 < 2.2e-16 ***
Age:Item 1 18.314 18.314 19.9703 2.152e-05 ***
Residuals 96 88.040 0.917
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
# --- 绘图 ---
p1 <- ggplot(demo_data, aes(x = Age, y = Score, color = Item, group = Item)) +
geom_point(alpha = 0.3) +
geom_smooth(method = "lm", se = FALSE, size = 1.5) +
theme_minimal() +
labs(title = "真实机制:显著的交互作用 (Interaction)",
subtitle = "ANOVA 结果显示 Age:Item 交互项显著\n说明斜率方向随题目而变") +
theme(legend.position = "bottom")
p2 <- ggplot(agg_data, aes(x = Age, y = Mean_Score)) +
geom_point(alpha = 0.3) +
geom_smooth(method = "lm", color = "black", size = 1.5) +
theme_minimal() +
labs(title = "聚合掩盖真相:主效应不显著",
subtitle = "ANOVA 结果显示 Age 主效应 p > .05\n错误地得出'年龄无关'的结论")
p1 + p2
- IV 与 Items 存在明显的交互作用(斜率一正一负)
- 当交互作用存在,但未被建模时,“主效应”实际上是一个被污染的指标——它要么被相反的斜率中和成了无意义的平均数,要么其显著性检验建立在错误的误差基准之上
- 如果 IV 与 Items 存在交互作用,但分析时没有建模交互作用,会发生什么?
概化理论认为:为了让结论具有推广性,统计上应假设使用的题目是从一个无限题库 (infinite pool of items) 中随机抽取的,题目斜率应被视作随机效应
无论是简单的回归(Aggregation)还是复杂的结构方程模型(SEM),都在不同程度上忽视了题目层面的斜率不一致。
# ==========================================
# 1. 数据生成:构造“矛盾”情境
# ==========================================
set.seed(999)
N <- 300
J <- 5
IV <- rnorm(N, 0, 1)
# A. 生成潜变量 (Factor)
# 假设 IV 对潜变量有强正向影响 (Beta = 0.6)
Latent_F <- 0.6 * IV + rnorm(N, 0, 0.8)
# B. 生成题目 (Items)
# 关键点:所有题目在测量模型上都是“好题”(正向载荷),内部一致性高
# y = 1.0 * F + unique_effect + error
sim_data_wide <- data.frame(ID = 1:N, IV = IV)
sim_data_long <- data.frame()
# 题目 1-4:完全听从潜变量指挥
for(j in 1:4){
y <- 1.0 * Latent_F + rnorm(N, 0, 1)
sim_data_wide[[paste0("y", j)]] <- y
sim_data_long <- rbind(sim_data_long, data.frame(ID=1:N, IV=IV, Item=paste0("Item", j), Score=y))
}
# 题目 5:叛逆者 (Item Specific Effect)
# 它虽然测量同一个潜变量(有 +1.0 * F),但 IV 对它有额外的直接负面打击 (-1.5 * IV)
# 净效应(Net Slope) ≈ 0.6 (from F) - 1.5 (Direct) = -0.9
y5 <- 1.0 * Latent_F - 1.5 * IV + rnorm(N, 0, 1)
sim_data_wide$y5 <- y5
sim_data_long <- rbind(sim_data_long, data.frame(ID=1:N, IV=IV, Item="Item5", Score=y5))
# ==========================================
# 2. 模型拟合
# ==========================================
# --- A. 聚合回归 ---
sim_data_wide$Mean_Score <- rowMeans(sim_data_wide[, paste0("y", 1:5)])
agg_model <- lm(Mean_Score ~ IV, data = sim_data_wide)
agg_intercept <- coef(agg_model)[1]
agg_slope <- coef(agg_model)[2]
# --- B. SEM (Common Factor) ---
sem_syntax <- '
F1 =~ y1 + y2 + y3 + y4 + y5
F1 ~ IV
'
sem_fit <- sem(sem_syntax, data = sim_data_wide, std.lv = TRUE)
# 提取 SEM 隐含的回归线
est <- parameterEstimates(sem_fit)
gamma <- est[est$op == "~" & est$lhs == "F1" & est$rhs == "IV", "est"] # 潜变量斜率
sem_lines <- data.frame()
for(j in 1:5){
item_name <- paste0("y", j)
# 截距
nu <- est[est$op == "~1" & est$lhs == item_name, "est"]
if(length(nu)==0) nu <- mean(sim_data_wide[[item_name]])
# 载荷
lam <- est[est$op == "=~" & est$rhs == item_name, "est"]
# 这里的关键:SEM 强行认为 斜率 = 载荷 * Gamma
# 因为 y1-y4 都是正相关,Gamma 是正的,且所有题目内部正相关,
# SEM 会估计出 y5 的载荷也是正的(因为 y5 也受 Latent_F 影响)
# 于是 SEM 会错误地预测 y5 随着 IV 增加而增加
implied_slope <- lam * gamma
temp <- data.frame(IV = seq(min(IV), max(IV), length.out=100), Item=paste0("Item", j))
temp$Score <- nu + implied_slope * temp$IV
sem_lines <- rbind(sem_lines, temp)
}
# ==========================================
# 3. 绘图对比
# ==========================================
common_theme <- theme_bw() +
theme(legend.position = "none", plot.title = element_text(face="bold"))
# Plot 1: Aggregation
p_agg <- ggplot(sim_data_long, aes(x = IV, y = Score)) +
geom_point(color="grey", alpha=0.3) +
geom_abline(intercept = agg_intercept, slope = agg_slope, color = "#D55E00", size = 2) +
labs(title = "1. Aggregation", subtitle = "简单平均,彻底掩盖 Item 5") +
ylim(-4, 4) + common_theme
# Plot 2: SEM
p_sem <- ggplot() +
geom_point(data = sim_data_long, aes(x = IV, y = Score, color = Item), alpha = 0.1) +
geom_line(data = sem_lines, aes(x = IV, y = Score, color = Item), size = 1.2) +
labs(title = "2. SEM (Common Factor)",
subtitle = "强制一致性:\n由于 Item 5 属于该构念,SEM 强行预测它\n随 IV 增加而增加 (紫色线向上)。\n这与数据事实(散点向下)完全相反") +
ylim(-4, 4) + common_theme
# Plot 3: Real Data / RIS
p_ris <- ggplot(sim_data_long, aes(x = IV, y = Score, color = Item)) +
geom_point(alpha = 0.2) +
geom_smooth(method = "lm", se = FALSE, size = 1.2) +
labs(title = "3. Real Data (RIS)",
subtitle = "真相:\nItem 5 (紫色) 实际上是负相关的。\n这是 SEM 无法捕捉的特异性斜率。") +
ylim(-4, 4) + common_theme
p_agg + p_sem + p_ris
my_labels <- c("Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "IV", "Factor")
semPaths(object = sem_fit,
what = "std",
whatLabels = "std",
layout = "tree2",
edge.label.cex = 1,
rotation = 2,
nodeLabels = my_labels,
)
title("Common Factor Model (SEM) 路径图", adj = 0.5, line = 2)
mtext("IV 到 Item 5 没有直接路径,必须经过 F1", side = 1, line = 0, cex = 1.2)
不仅仅是统计方法的改变,更是测量哲学的改变。
传统聚合回归 (Aggregation Model): 假设题目对 IV 的反应是固定的、一致的。 \[ y_i = \beta_0 + \beta_1 x_i + \epsilon_i \]
随机题目斜率回归 (RISR, Equation 4): 假设题目是从题库中随机抽取的,对 IV 的敏感度各不相同。 \[ y_{ij} = \beta_0 + u_{0i} + u_{0j} + (\beta_1 + \mathbf{u_{1j}})x_i + \epsilon_{ij} \]
其中核心差异在于 \(\mathbf{u_{1j}}\):
忽略 \(u_{1j}\) 会导致假阳性(Type I Error),根本原因在于\(t\)值计算错误。
在线性回归中,判断显著性的 \(t\) 值计算公式为: \[ t = \frac{\text{Estimate}}{\text{Standard Error}} = \frac{\hat{\beta}_1}{SE(\hat{\beta}_1)} \]
如果题目本身存在斜率变异(\(\tau_{11} > 0\)),使用了传统模型(忽略它)时,会得到一个被低估的 SE。分母变小 \(\rightarrow\) t 值虚高 \(\rightarrow\) 假阳性(Type I Error)。
根据论文附录证明,两种模型对 SE 的估计截然不同:
传统模型 (Naive SE): 认为只要增加被试量 \(N\),误差就能无限缩小: \[ SE_{naive} \approx \sqrt{\frac{\sigma^2_{residual}}{N \times J \times \sigma^2_x}} \] > 当 \(N \to \infty\), \(SE \to 0\)。
RISR 模型 (True SE): 引入了题目采样的不确定性(Generalization Error),以下公式由文章中A10变形而来: \[ SE_{true} \approx \sqrt{\frac{\sigma^2_{residual}}{N \times J \times \sigma^2_x} + \mathbf{\frac{\tau_{11}}{J}}} \] > 当 \(N \to \infty\),第一项趋近于0,但第二项 \(\frac{\tau_{11}}{J}\) 依然存在
比较 真实模型 SE (RISR) 和 错误模型 SE (Aggregation/Naive) 的比率,比率越大,说明错误模型低估得越严重(即错得越离谱)
由附录 A 的推导可以构造比率 \(K\):
\[ \text{Ratio } K = \frac{SE_{True}}{SE_{Naive}} = \sqrt{1 + \frac{I \cdot \tau_{11} \cdot s_x^2}{\sigma^2 + J \cdot \omega_{00}}} \]
larger underestimation when there is larger residual error variance(?×)
图解:传统模型(蓝色线),当 \(N=3000\) 时,SE 几乎为 0,此时哪怕 \(\hat{\beta}\) 只有微小的 0.01,计算出的 \(t\) 值也会很大,导致显著的结果。这解释了为什么大数据集特别容易出现 Random Item Slope 导致的假阳性。
为什么 Cronbach’s \(\alpha\) 或 SEM 模型拟合(CFI/RMSEA)时没有发现?
\(\alpha\) 系数反映的是题目分数的内部一致性。 \[ Var(y_{ij}) = \underbrace{\omega_{00}}_{\text{人与人的巨大差异}} + \tau_{00} + \underbrace{\tau_{11}x_i^2}_{\text{微小的斜率差异}} + \sigma^2 \]
\[ \alpha \approx \frac{J \cdot \omega_{00}}{J \cdot \omega_{00} + (\sigma^2 + \tau_{11})} \]
Common Factor Regression虽然比聚合回归严谨,它本质上是一个Constrained Model,它强迫所有题目通过潜变量产生联系:
实证证据 (Real Data): 论文使用了 \(N=564\) 的真实数据发现,即使 CFI = 0.956, RMSEA = 0.087 这样被认为“可接受”的模型,在使用 RISR 检验后,依然发现了显著的 Random Item Slopes,且推翻了之前的显著性结论。
结论:高信度 (\(\alpha\)) 和高拟合度 (CFI) 不能 作为不存在 Random Item Slope 的证据。
首先在模拟环境下证明传统模型会犯错,然后在真实环境(实测数据)中证明这种情况确实存在
文章构建了 72 种不同的参数组合,系统改变了样本量 (\(N\))、题目数量 (\(J\)) 和随机斜率的方差大小 (\(\tau_{11}\))。
在模拟中,设定 IV 和 DV 的真实关系为 0 (\(\beta_1 = 0\))。因此,任何“显著”的结果都是假阳性(Type I Error)。
模拟显示,即使随机题目斜率的方差非常小(仅占相关误差方差的 0.549%),在大样本下(\(N=1000\))也足以导致传统模型的统计推断失效,说明以往研究中存在普遍的隐患。
作者收集了 \(N=564\) 的数据,使用了心理学常用的量表(如大五人格、自我实现量表等)和反应时任务。
一个戏剧性的例子,一项探究“年龄”是否预测“自我实现”得分的研究中。
模型结果对比
传统聚合回归与 RISR 模型的结果中,回归系数 (\(b\)) 是相同的,但标准误 (\(SE\)) 发生了剧烈变化
| 模型类型 | 回归系数 (\(\hat{\beta}_1\)) | 标准误 (\(SE\)) | \(t\) 值 | \(p\) 值 | 实质结论 |
|---|---|---|---|---|---|
| Aggregation | -0.062 | 0.015 (被低估) | -4.18 | < .001 (显著) | 年龄越大,自我实现感越低 |
| RISR | -0.062 | 0.032 (已校正) | -1.96 | .066 (不显著) | 年龄与自我实现感无显著关系 |
RISR 估计出的 \(SE\) 是传统方法的 2 倍多。这直接导致显著性消失,推翻了原有结论。
为什么会有这么大的差异?检查单个题目的斜率有以下发现:
| 题目类型 | 代表题目 (Items) | 对年龄的反应 (Slope) | 心理学解释 |
|---|---|---|---|
| 驱动因子 (Drivers) | Item 8 (“I fear failure”) Item 14 (““I am bothered by fears of being inadequate”) |
强负相关 (随年龄大幅下降) | 年龄增长显著降低了“对失败的恐惧” |
| 无关因子 (Neutrals) | 大部分其他题目 | 接近零 或 微弱正相关 | 年龄对自我实现的其他维度影响甚微 |
结论:所谓的“显著负相关”完全是由少数几个关于“恐惧”的题目驱动的,RISR 像一把手术刀,切分了构念层面和题目层面的效应。 RISR的分析来看,年龄增长可能只是让人“不再害怕失败”,而不是“自我实现感降低”
在测试的所有 IV-DV 组合中,随机题目斜率普遍存在。在某些情况下,RISR 估计出的随机斜率方差甚至远大于模拟中设定的水平。这表明过去文献中许多“小而显著”的大样本效应,可能只是由于量表中混入了几个对 IV 特别敏感的题目。
RISR 本质上是一个 交叉分类混合效应模型 (Cross-Classified Mixed-Effects Model)。之所以叫“交叉”,是因为每个被试都回答了所有题目(或大部分),被试和题目不是嵌套关系,而是交叉关系
使用 lme4 包可实现 RISR 模型。 \[\text{Score}_{ij} \sim \beta_0 + (\beta_1 +
u_{1j}) \cdot \text{IV}_i + (u_{0i} + u_{0j}) +
\epsilon_{ij}\]
在lme4语法中的表达:
library(lme4)
risr_model <- lmer(
Score ~ IV + # 固定效应:要测的平均关系
(1 | ID) + # 随机截距 (被试):每个人基础分不同
(1 + IV | Item), # 随机斜率 (题目):关键!允许 IV 对不同 Item 的影响不同
data = long_data
)
要求长数据格式 (Long Format),每行是一个观察值 single subject answers single item response data in long format
生成模拟数据集,演示“聚合回归”转向“RISR”
library(lme4)
library(broom.mixed)
library(lmerTest) # 计算 p 值
# 1. 传统聚合回归 (Aggregation)
# 需要先计算平均分
agg_df <- sim_data_long %>%
group_by(ID, IV) %>%
summarise(Mean_Score = mean(Score))
model_agg <- lm(Mean_Score ~ IV, data = agg_df)
# 2. 随机截距模型 (Random Intercept Only)
# 这是很多研究者误用的模型,只考虑了题目难度不同,没考虑斜率不同
model_ri <- lmer(Score ~ IV + (1|ID) + (1|Item), data = sim_data_long)
# 3. 随机题目斜率模型 (RISR - Proposed)
# 允许 (1 + IV | Item)
model_risr <- lmer(Score ~ IV + (1|ID) + (1 + IV | Item), data = sim_data_long)
# --- 提取结果进行对比 ---
# 辅助函数提取系数
get_res <- function(mod, name) {
if(inherits(mod, "lm")) {
res <- tidy(mod) %>% filter(term == "IV")
} else {
res <- tidy(mod, effects = "fixed") %>% filter(term == "IV")
}
res %>% select(estimate, std.error, statistic, p.value) %>% mutate(Model = name)
}
res_table <- rbind(
get_res(model_agg, "1. Aggregation (OLS)"),
get_res(model_ri, "2. Random Intercepts (LMM)"),
get_res(model_risr,"3. RISR (Proposed)")
)
print(res_table)
RISR 的强大之处在于它可以估计出每个题目独特的斜率(BLUPs, Best Linear Unbiased Predictions),可以把模型“眼中”的题目斜率画出来。
# 提取随机效应
ranef_data <- ranef(model_risr)$Item
ranef_data$Item <- rownames(ranef_data)
# 固定效应
fixed_slope <- fixef(model_risr)["IV"]
fixed_intercept <- fixef(model_risr)["(Intercept)"]
# 计算每个题目的总斜率 (Fixed + Random)
item_slopes <- ranef_data %>%
mutate(
Total_Slope = fixed_slope + IV,
Total_Intercept = fixed_intercept + `(Intercept)`
)
# 绘图
ggplot() +
# 背景:原始数据点
geom_point(data = sim_data_long, aes(x = IV, y = Score), color = "grey", alpha = 0.1) +
# 线条:RISR 估计的每道题的回归线
geom_abline(data = item_slopes,
aes(intercept = Total_Intercept, slope = Total_Slope, color = Item),
size = 1) +
# 粗黑线:平均效应 (Fixed Effect)
geom_abline(intercept = fixed_intercept, slope = fixed_slope,
color = "black", size = 2, linetype = "dashed") +
labs(title = "RISR 模型的透视图",
subtitle = "虚线为平均效应 (不显著),彩色实线为各题目的特定效应。\n模型'看到'了 Item 5 (紫色) 的剧烈反向,因此“惩罚”了整体的显著性。",
x = "Independent Variable (IV)", y = "Item Score") +
theme_minimal() +
theme(legend.position = "right")
传统的 Aggregation 或 SEM 试图寻找一条最能代表所有人的线(虚线)。 而 RISR 承认每一条彩色线的真实性。当彩色线(题目斜率)像这样发散(Heterogeneity)时,RISR 会认为:“虽然平均线是平的或微正的,但由于题目间分歧太大,这个平均结果不可靠。”
Donnellan et al. (2025) 并不建议废除 SEM,而是提出了一种替代视角。
| 维度 | SEM (Common Factor) | RISR (Mixed Models) |
|---|---|---|
| 适用场景 | 构念定义极其严格,题目必须高度同质 (如智力测验 g 因素) | 构念定义宽泛,题目具有异质性 (如外向性:演讲 vs 聊天) |
| 对不一致斜率的处理 | 视为噪音或模型拟合差 (Bad Fit) | 视为真实变异 (Real Variance),并纳入 SE 计算 |
| 结论推广性 | 仅推广到“当前这组题目” | 推广到“该构念的所有潜在题目” |
RISR “Treat items as random samples, not fixed indicators.”
RISR 并不是要否定过去的所有研究,而是提醒研究者在处理异质性题目和大样本数据时,需要更加谦卑地对待统计推断的不确定性。当声称发现了一个关于“构念”的真理时,要确保这个真理不是仅由其中一两个题目驱动的。
一点点小延伸