【发布时间】:2019-08-28 22:48:33
【问题描述】:
我正在运行一个线性混合模型,以查看任务的反应时间是否因受试者、实验条件或目标而异。但是,当我运行 lme 时,它会警告我关于奇异拟合。
我知道奇异拟合可能表示模型过拟合,但我不明白为什么我的模型与我拥有的数据量过拟合。
如需更多信息,该实验涉及受试者为一系列图片命名,并记录反应时间 (RT)。每个参与者看到所有图片(目标)并具有所有 4 个条件。每个条件下有 440 个目标,其中 110 个目标。
我的第一个模型没有单一的拟合问题:
model1 = lmer(log(RTs300ms)~Condition+(1|Targets)+(1|Subject),data=beh_acc2)
REML criterion at convergence: -6030.481
Random effects:
Groups Name Std.Dev.
Targets (Intercept) 0.07918
Subject (Intercept) 0.13678
Residual 0.17972
Number of obs: 10985, groups: Targets, 110; Subject, 27
Fixed Effects:
(Intercept) ConditionTh ConditionUnTa ConditionUnTh
6.67960 -0.03549 -0.01475 -0.01700
但是从我的第二个模型开始,我开始遇到问题:
model2 = lmer(log(RTs300ms)~Condition+(1|Targets)+(1+Condition|Subject),data=beh_acc2)
REML criterion at convergence: -6037.6
Scaled residuals:
Min 1Q Median 3Q Max
-7.3985 -0.6456 -0.1593 0.4551 5.3105
Random effects:
Groups Name Variance Std.Dev. Corr
Targets (Intercept) 6.270e-03 0.079184
Subject (Intercept) 1.947e-02 0.139546
ConditionTh 2.482e-05 0.004982 0.58
ConditionUnTa 2.273e-04 0.015078 -0.50 0.41
ConditionUnTh 1.200e-04 0.010956 -0.64 0.26 0.99
Residual 3.226e-02 0.179597
Number of obs: 10985, groups: Targets, 110; Subject, 27
Fixed effects:
Estimate Std. Error t value
(Intercept) 6.679624 0.028108 237.641
ConditionTh -0.035441 0.004949 -7.162
ConditionUnTa -0.014807 0.005648 -2.621
ConditionUnTh -0.017071 0.005293 -3.225
Correlation of Fixed Effects:
(Intr) CndtnT CondtnUnT
ConditionTh 0.022
ConditinUnT -0.321 0.463
ConditnUnTh -0.321 0.471 0.597
convergence code: 0
boundary (singular) fit: see ?isSingular
理想情况下,我希望我的最终模型能够工作,但它是三个模型中最复杂的一个:
model3 = lmer(log(RTs300ms)~Condition+(1+Condition|Targets)+(1+Condition|Subject),data=beh_acc2)
REML criterion at convergence: -6068.3
Scaled residuals:
Min 1Q Median 3Q Max
-7.3684 -0.6393 -0.1575 0.4541 5.2834
Random effects:
Groups Name Variance Std.Dev. Corr
Targets (Intercept) 6.931e-03 0.083252
ConditionTh 1.008e-03 0.031748 -0.19
ConditionUnTa 1.419e-03 0.037676 -0.35 0.58
ConditionUnTh 1.727e-03 0.041553 -0.29 0.72 0.98
Subject (Intercept) 1.951e-02 0.139662
ConditionTh 2.575e-05 0.005074 0.57
ConditionUnTa 2.371e-04 0.015399 -0.50 0.43
ConditionUnTh 1.237e-04 0.011124 -0.63 0.28 0.99
Residual 3.187e-02 0.178527
Number of obs: 10985, groups: Targets, 110; Subject, 27
Fixed effects:
Estimate Std. Error t value
(Intercept) 6.679466 0.028234 236.574
ConditionTh -0.035074 0.005785 -6.063
ConditionUnTa -0.014748 0.006706 -2.199
ConditionUnTh -0.016823 0.006607 -2.546
Correlation of Fixed Effects:
(Intr) CndtnT CondtnUnT
ConditionTh -0.008
ConditinUnT -0.325 0.497
ConditnUnTh -0.306 0.548 0.722
convergence code: 0
boundary (singular) fit: see ?isSingular
我不确定如何解决我在模型 2 和模型 3 上遇到的奇异拟合问题。我已经阅读了一些我不熟悉的尝试贝叶斯模型的建议。
我们将不胜感激有关此问题的任何建议或进一步建议!
【问题讨论】:
-
你读过
?lme4::isSIngular和stats.stackexchange.com/questions/378939/… 和bbolker.github.io/mixedmodels-misc/… 了吗...? -
当您适合
(1+Condition|g)(其中g是一个分组变量)时,您正在尝试估计 4x4 协方差矩阵的参数 = 4*(4+1)/2=10参数。当g=Target时,您有 110 个观察值,因此 可能 起作用(根据经验,您需要的观察值是参数的 10-20 倍);当g=Subject有 27 个观察值时,几乎可以肯定这不起作用。 -
@BenBolker 我还没有阅读那个特定的帖子 - 谢谢你的帮助,我会看看那些!
标签: r lme4 mixed-models