Reputation: 19
Here are my variables:
I have 60 participants in total (30 in each binary X). I want to see if M has any moderating effects on X and Y. I dummy coded X into 0 and 1 after changing it into a factor (as.factor). I then ran an lm() in R with interaction (X*M) and all main effects and interaction were significant as seen below.
I would now like to plot this and I'm trying to use interact_plot from the interactions package. Here is my code:
interact_plot(model = reg, pred = IncOrExc, modx = PerRisk)
But I get the following error message
Focal predictor ("pred") cannot be a factor. Either use it as modx, convert it to a numeric dummy variable
How can I fix this?
Upvotes: 0
Views: 461
Reputation: 11
I think I'm quite late but... Interact_plot plots a continuous predictor variable on a continuous outcome. The moderator is the one that can be continuous or a factor. From your example, IncOrExc is the one you transform into a factor, right? So interact_plot is telling you that you should change it to a continuous predictor variable in order to plot it.
Upvotes: 1