Reputation: 19
I created an interaction term with iv*sex and imputed the data with mice. Then used the imputed data to run a logistic regression model (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
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. It will be greatly appreciated if any solutions is offered. Thanks!
Upvotes: 1
Views: 1797
Reputation: 11
I've just run into the same issue, and with effects
package I solved it.
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".
Upvotes: 0