r - 使用 mitml、nlme 和 geepack R 包进行多重插补后获得估计均值
问题描述
我正在通过包mitml
(使用函数)运行多级多重插补,并通过包和panimpute()
函数拟合线性混合模型和边际模型。nlme
geepack
mitml:with()
我可以通过该函数获得估计值、p 值等,testEstimates()
但我也希望在我的模型预测变量中获得估计均值。我已经尝试过这个emmeans
包,我通常使用它来在nlme & geepack
没有多重插补的情况下运行时获得估计的平均值,但这样做的emmeans告诉我“无法处理类“mitml.result”的对象”。
我想知道有没有办法从我运行的多重插补分析中获得汇总的估计均值?
我正在分析的数据框是纵向/重复测量和长格式。在线性混合模型中,我想获得 2x2 交互效应的估计均值,而在边际模型中,我试图获得 6 个“时间”变量水平的估计均值。所有模型的结果都是连续的。
这是我的代码
# mixed model
fml <- Dep + time ~ 1 + (1|id)
imp <- panImpute(data=Data, formula=fml, n.burn=50000, n.iter=5000, m=100, group = "treatment")
summary(imp)
plot(imp, trace="all")
implist <- mitmlComplete(imp, "all", force.list = TRUE)
fit <- with(implist, lme(Dep ~ time*treatment, random = ~ 1|id, method = "ML", na.action = na.exclude, control = list(opt = "optim")))
testEstimates(fit, var.comp = TRUE)
confint.mitml.testEstimates(testEstimates(fit, var.comp = TRUE))
# marginal model
fml <- Dep + time ~ 1 + (1|id)
imp <- panImpute(data=Data, formula=fml, n.burn=50000, n.iter=5000, m=100)
summary(imp)
plot(imp, trace="all")
implist <- mitmlComplete(imp, "all", force.list = TRUE)
fit <- with(implist, geeglm(Dep ~ time, id = id, corstr ="unstructured"))
testEstimates(fit, var.comp = TRUE)
confint.mitml.testEstimates(testEstimates(fit, var.comp = TRUE))
解决方案
推荐阅读
- assembly - 寄存器值问题的小端表示
- angular - 如何实现 MAT_DIALOG_DEFAULT_OPTIONS?
- android - MenuItem 的图标颜色没有改变
- android - Android 三项并排
- c# - 尝试使用 C# 调用 Google auth2.0 时出现 403 错误
- javascript - 在节点鼠标悬停时显示自定义工具提示(强制定向 d3 图)
- php - 如何在关联ID不相等的Doctrine中查询ManyToMany关系
- ajax - 没有出现任何异常,但数据没有存储到数据库中
- android - 如何在android中将输入流转换为字节数组到字符串
- wordpress - 从 wp 评论中删除回复按钮