我目前正在研究多级模型 . 我的个人群体是“一个人是多么满意”,其他变量是“收入感觉”,“ Health ”,工作,社交,国家 .

我的小组水平是:国家和密度 .

我正在显示四种不同类型的模型(不同的截距,没有预测因子/不同的截距与单独的水平预测器/ ......)现在我遇到了使用组级预测模型的变化截距的问题,该模型显示了如图所示的错误下面的代码 .

M3 = lmer(happylyf ~ incomefeel + healthy + workinf + social + density + (1 | country), 
          + family(binomial(link = "logit")),data = Mer)

UseMethod(“family”)中的错误:“family”不适用于“family”类对象的适用方法

这显示了响应的结构

str(Mer$happylyf)
# num [1:10977] 4 5 4 4 4 4 2 3 4 4 ...
#1=unhappy (...) 5=very happy

此外,当我用组级预测模型显示变化截距和斜率时,这就是我得到的 .

M4 = lmer ( happylyf ~ incomefeel + healthy + workinf + social + 
                       density:incomefeel + density:healthy + density:workinf + density:social +
                (1 + incomefeel + healthy + workinf + social |country), data = Mer)

警告消息:1:一些预测变量的尺度非常不同:考虑重新缩放2:在checkConv(attr(opt,“derivs”),opt $ par,ctrl = control $ checkConv,:无法评估缩放的渐变3:In checkConv(attr(opt,“derivs”),opt $ par,ctrl = control $ checkConv,:模型未能收敛:使用1个负特征值退化Hessian