嵌套数据集的混合模型 - 不收敛

问题描述 投票:0回答:1

我有一个数据集,其中包含学校内的学生。我的一些变量在不同学校之间有所不同,但在学校内部却没有差异(例如:学校的社会经济指数或学校所在地区),而其他变量则因学生而异。

我正在将以下模型与 R 的 lme4 包中的 lmer 函数一起应用,但第二个模型(其中我包含在学校内不作为随机效应变化的变量)不收敛。

您能给我一些如何处理这个问题的想法吗?

模型1:只有截距是随机效应

m1 = lmer( english_scores ~ (1| school_id) + school_region + school_linguistic_region + school_socioeconomic + school_size + student_birth + student_gender + student_socioeconomic + student_inmigrant + student_spanish_score + student_maths_score + student_language, data=primary) 

模型2:截距和斜率都是随机效应

m2 = lmer( english_scores ~ (1 + school_region + school_linguistic_region + school_socioeconomic + school_size | school_id) + school_region + school_linguistic_region + school_socioeconomic + school_size + student_birth + student_gender + student_socioeconomic + student_inmigrant + student_spanish_score + student_maths_score + student_language, data=primary)

运行第二个模型时出现以下错误:

boundary (singular) fit: see help('isSingular') Warning message: Model failed to converge with 2 negative eigenvalues: -3.4e+00 -9.3e+00 

我尝试减少模型中包含的随机斜率的数量,因此使用:

m2 = lmer( english_scores ~ (1 + school_socioeconomic + school_size | school_id) + school_socioeconomic + school_size + student_birth + student_gender + student_socioeconomic + student_inmigrant + student_spanish_score + student_maths_score + student_language, data=primary) 

在这种情况下,我仍然收到以下错误消息:

Warning messages: 1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 3.41928 (tol = 0.002, component 1) 2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model is nearly unidentifiable: very large eigenvalue - Rescale variables?
r nested lme4 mixed-models
1个回答
0
投票

有问题的模型:

m2 = lmer( english_scores ~ (1 + school_region + school_linguistic_region + school_socioeconomic + school_size | school_id) + school_region + school_linguistic_region + school_socioeconomic + school_size + student_birth + student_gender + student_socioeconomic + student_inmigrant + student_spanish_score + student_maths_score + student_language, data=primary)

..具有随机斜率:

school_region
school_linguistic_region
school_socioeconomic
school_size

由于这些在学校内都没有变化,因此将它们指定为学校内的随机坡度没有任何意义。

您能给我一些如何处理这个问题的想法吗?

是的,不要为这些变量拟合随机斜率。

© www.soinside.com 2019 - 2024. All rights reserved.