ISSN 0439-755X
CN 11-1911/B

心理学报 ›› 2024, Vol. 56 ›› Issue (1): 124-138.doi: 10.3724/SP.J.1041.2024.00124

• 研究报告 • 上一篇    下一篇


刘玥1, 徐雷1, 刘红云2,3(), 韩雨婷4, 游晓锋5, 万志林1   

  1. 1四川师范大学脑与心理科学研究院, 成都 610066
    2应用实验心理北京市重点实验室, 北京 100875
    3北京师范大学心理学部, 北京 100875
    4北京语言大学心理学院, 北京 100083
    5南昌师范学院数学与信息科学学院, 南昌 360111
  • 收稿日期:2023-01-04 发布日期:2023-11-23 出版日期:2024-01-25
  • 通讯作者: 刘红云
  • 基金资助:

Confidence interval width contours: Sample size planning for linear mixed-effects models

LIU Yue1, XU Lei1, LIU Hongyun2,3(), HAN Yuting4, YOU Xiaofeng5, WAN Zhilin1   

  1. 1Institute of Brain and Psychological Sciences, Sichuan Normal University, Chengdu 610066, China
    2Beijing Key Laboratory of Applied Experimental Psychology, Beijing Normal University, Beijing 100875, China
    3Faculty of Psychology, Beijing Normal University, Beijing 100875, China
    4School of Psychology, Beijing Language and Culture University, Beijing, 100083, China
    5School of Mathematics and Information Science, Nanchang Normal University, Nanchang 360111, China
  • Received:2023-01-04 Online:2023-11-23 Published:2024-01-25
  • Contact: LIU Hongyun


线性混合效应模型在分析具有嵌套结构的心理学实验数据时具有明显优势。本文提出了置信区间宽度等高线图用于该模型的样本量规划。通过等高线图, 确定同时符合检验力、效应量准确性以及置信区间宽度要求的被试量和试次数。结合关注被试内实验效应和被试变量调节效应的两类典型模型, 通过两个模拟研究, 采用基于蒙特卡洛模拟方法, 探索效应量、随机效应大小和被试变量类型对置信区间宽度等高线图及样本量规划结果的影响。

关键词: 线性混合效应模型, 多水平模型, 检验力分析, 效应量, 置信区间宽度


Hierarchical data, which is observed frequently in psychological experiments, is usually analyzed with the linear mixed-effects models (LMEMs), as it can account for multiple sources of random effects due to participants, items, and/or predictors simultaneously. However, it is still unclear of how to determine the sample size and number of trials in LMEMs. In history, sample size planning was conducted based purely on power analysis. Later, the influential article of Maxwell et al. (2008) has made clear that sample size planning should consider statistical power and accuracy in parameter estimation (AIPE) simultaneously. In this paper, we derive a confidence interval width contours plot with the codes to generate it, providing power and AIPE information simultaneously. With this plot, sample size requirements in LMEMs based on power and AIPE criteria can be decided. We also demonstrated how to run sensitivity analysis to assess the impact of the magnitude of experiment effect size and the magnitude of random slope variance on statistical power, AIPE and the results of sample size planning.

There were two sets of sensitivity analysis based on different LMEMs. Sensitivity analysis Ⅰ investigated how the experiment effect size influenced power, AIPE and the requirement of sample size for within-subject experiment design, while sensitivity analysis Ⅱ investigated the impact of random slope variance on optimal sample size based on power and AIPE analysis for the cross-level interaction effect. The results for binary and continuous between-subject variables were compared. In these sensitivity analysis, two factors regarding sample size varied: number of subjects (I= 10, 30, 50, 70, 100, 200, 400, 600, 800), number of trials (J= 10, 20, 30, 50, 70, 100, 150, 200, 250, 300). The additional manipulated factor was the effect size of experiment effect (standard coefficient of experiment condition = 0.2, 0.5, 0.8, in sensitivity analysis I) and the magnitude of random slope variance (0.01, 0.09 and 0.25, in sensitivity analysis Ⅱ). A random slope model was used in sensitivity analysis Ⅰ, while a random slope model with level-2 independent variable was used in sensitivity analysis II. Data-generating model and fitted model were the same. Estimation performance was evaluated in terms of convergence rate, power, AIPE for the fixed effect, AIPE for the standard error of the fixed effect, and AIPE for the random effect.

The results are as following. First, there were no convergence problems under all the conditions, except that when the variance of random slope was small and a maximal model was used to fit the data. Second, power increased as sample size, number of trials or effect size increased. However, the number of trials played a key role for the power of within-subject effect, while sample size was more important for the power of cross-level effect. Power was larger for continuous between-subject variable than for binary between-subject variable. Third, although the fixed effect was accurately estimated under all the simulation conditions, the width 95% confidence interval (95% width) was extremely large under some conditions. Lastly, AIPE for the random effect increased as sample size and/or number of trials increased. The variance of residual was estimated accurately. As the variance of random slope increased, the accuracy of the estimates of variances of random intercept decreased, and the accuracy of the estimates of random slope increased.

In conclusion, if sample size planning was conducted solely based on power analysis, the chosen sample size might not be large enough to obtain accurate estimates of effects size. Therefore, the rational for considering statistical power and AIPE during sample size planning was adopted. To shed light on this issue, this article provided a standard procedure based on a confidence interval width contours plot to recommend sample size and number of trials for using LMEMs. This plot visualizes the combined effect of sample size and number of trials per participant on 95% width, power and AIPE for random effects. Based on this tool and other empirical considerations, practitioners can make informed choices about how many participants to test, and how many trials to test each one for.

Key words: linear mixed-effects models, multilevel models, power analysis, effect size, confidence interval width