【发布时间】:2018-12-19 16:49:10
【问题描述】:
过去,我曾使用包 sjPlot 中的 sjp.glmer 来可视化广义混合效应模型的不同斜率。但是,使用新包时,我无法弄清楚如何绘制各个斜率,如图所示(随机)组级别的固定效应概率,位于here
这是我认为应该允许生成图形的代码。我只是在sjPlot 的新版本中似乎无法获得它。
library(lme4)
library(sjPlot)
data(efc)
# create binary response
efc$hi_qol = 0
efc$hi_qol[efc$quol_5 > mean(efc$quol_5,na.rm=T)] = 1
# prepare group variable
efc$grp = as.factor(efc$e15relat)
# data frame for 2nd fitted model
mydf <- na.omit(data.frame(hi_qol = as.factor(efc$hi_qol),
sex = as.factor(efc$c161sex),
c12hour = as.numeric(efc$c12hour),
neg_c_7 = as.numeric(efc$neg_c_7),
grp = efc$grp))
# fit 2nd model
fit2 <- glmer(hi_qol ~ sex + c12hour + neg_c_7 + (1|grp),
data = mydf,
family = binomial("logit"))
我尝试使用以下代码绘制模型。
plot_model(fit2,type="re")
plot_model(fit2,type="prob")
plot_model(fit2,type="eff")
我认为我可能缺少一个标志,但是在阅读了文档后,我无法找出那个标志可能是什么。
【问题讨论】:
-
只是澄清一下:您是在谈论链接博客文章中的
type = "ri.prob"?您能具体说明您尝试过的方法和无效的方法吗? -
我说的是情节类型=“ri.prob”。我将编辑我的问题以显示我尝试过的内容。