简体   繁体   English

plot - 如何绘制逻辑回归模型 (glm) 与多重插补数据 (MICE) 的相互作用?

[英]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.

相关问题 如何获得多元逻辑回归模型(glm)的校准图? - How to get the calibration plot of a multivariable logistic regression model (glm)? plot如何进行逻辑回归 - How to plot a logistic regression 如何 plot 与 R 中的逻辑回归 model 中的两个分类预测变量进行双向交互? - How to plot a two-way interaction with two categorical predictors from a logistic regression model in R? 如何在Ggplot 2中的一个图上绘制多个逻辑回归曲线 - How to plot multiple logistic regression curves on one plot in Ggplot 2 对 MICE 插补数据的逻辑回归的奇数比和 95% 置信区间 - Odd ratios and 95% confidence intervals from logistic regression on data imputed with MICE 绘制R中逻辑回归模型的多个ROC曲线 - plot multiple ROC curves for logistic regression model in R 如何扩展逻辑回归 plot? - How to extend logistic regression plot? 如何在R中绘制lm()/ glm()回归模型的排序系数? - How to plot the sorted coefficients for a lm()/glm() regression model in R? R:如何使用 plot ROC 进行逻辑回归 model 缺少值 - R: how to plot ROC for logistic regression model whit missing values 如何使用基数 R 和 ggplot Plot 逻辑回归 model 的结果 - how to Plot the results of a logistic regression model using base R and ggplot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM