MICE多次插补后比较多级模型时出错

问题描述

我使用MICE软件包安装了两个嵌套模型,以进行多次插补。我现在想比较模型,但是函数D3产生以下错误

as.data.frame.default(data)中的错误: 无法将类“ c(“ lmeStructInt”,“ lmeStruct”,“ modelStruct”)'强制转换为data.frame

数据集包含来自家庭的问卷调查数据。当父母双方都填写有关孩子的调查表时,使用lme拟合了一个多层次模型。我有以下代码

MLM_analyses <- data.frame(werkdoc$Total_Problems_Tscore,werkdoc$Internalizing_Problems_Tscore,werkdoc$externalizing_Problems_Tscore,werkdoc$Groep,werkdoc$totaalzichtbaarheid,werkdoc$totaaloverig,werkdoc$PANAS.pos,werkdoc$PANAS.neg,werkdoc$age.child,werkdoc$Geslacht,werkdoc$age.parent,werkdoc$Geslacht.kd,werkdoc$GezinTotaal,werkdoc$opleiding.laag.midden.hoog) 

qpredR <- quickpred(MLM_analyses,exclude = c("werkdoc.Total_Problems_Tscore","werkdoc.Internalizing_Problems_Tscore","werkdoc.externalizing_Problems_Tscore","werkdoc.GezinTotaal","werkdoc.age.child"))
meth <- make.method(MLM_analyses)
meth[c("werkdoc.Total_Problems_Tscore","werkdoc.age.child")] <- ""
qpredR[,c("werkdoc.GezinTotaal")] <- 0
diag(qpredR) <- 0; qpredR[which(meth == ""),] <- 0
rowSums(qpredR); mean(rowSums(qpredR[-which(rowSums(qpredR)== 0),]))
ini <- mice(MLM_analyses,predictorMatrix = qpredR,maxit = 0,m = 1,printFlag = F,method = meth,seed = 2020)
ini$loggedEvents

dsImp <- mice(MLM_analyses,maxit = 5,m = 5,seed = 2020)


plot(ini)

#Create the models
MLM.ext.1 <- with(dsImp,expr = lme(werkdoc.externalizing_Problems_Tscore ~ werkdoc.Groep + ns(werkdoc.totaalzichtbaarheid,2) + werkdoc.totaaloverig + werkdoc.PANAS.pos + werkdoc.PANAS.neg + werkdoc.age.child + werkdoc.Geslacht.kd + werkdoc.age.parent + werkdoc.Geslacht + werkdoc.opleiding.laag.midden.hoog,random = ~ 1 | werkdoc.GezinTotaal,na.action = na.omit))

MLM.ext.2 <- with(dsImp,expr = lme(werkdoc.externalizing_Problems_Tscore ~  werkdoc.totaaloverig + werkdoc.Geslacht,na.action = na.omit))

D3(MLM.ext.1,MLM.ext.2)
     

有人知道这里出了什么问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)