[英]plot - How to plot interaction of logistic regression model (glm) with multiple imputed data (MICE)?
I created an interaction term with iv*sex and imputed the data with mice.我用 iv*sex 创建了一个交互项,并用小鼠估算了数据。 Then used the imputed data to run a logistic regression model (glm):
然后使用插补数据运行逻辑回归模型 (glm):
model <- with(data=imp, glm(dv~control+iv+sex+iv*sex, family="binomial"))
The following are the abbreviations of the variable names: dependent variable=dv, independent variable=iv, moderator=sex, interaction term= iv*sex以下是变量名称的缩写:因变量=dv,自变量=iv,主持人=sex,交互项=iv*sex
There is significant interaction for iv*sex and I would like to plot a graph for the interaction but I couldn't find how to. iv*sex 有显着的交互作用,我想绘制交互作用的图表,但我找不到方法。 It will be greatly appreciated if any solutions is offered.
如果提供任何解决方案,将不胜感激。 Thanks!
谢谢!
I've just run into the same issue, and with effects
package I solved it.我刚刚遇到了同样的问题,我用
effects
包解决了它。
e <- effects::effect("iv*sex", model)
e <- as.data.frame(e)
ggplot2::ggplot(e, ggplot2::aes(iv, fit, color=sex, group = sex)) +
ggplot2::geom_point() +
ggplot2::geom_line() +
"fit" is your dependent variable, in your case "dv". “适合”是您的因变量,在您的情况下是“dv”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.