I would like to plot on the same graph the interaction between my continuous predictor and my categorical moderator. I know how to do it when both are categorical (factor interaction), but don't really know how to do it when one is continuous and one is categorical.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
If you're talking about an interaction in a general linear model (e.g., ANCOVA), and if your categorical moderator has a reasonably small number of levels, you can plot separate regression lines for each level of the moderator. If you want these on the same plot, superimpose them, code by color or line type, and provide a legend. One of your plot's axes will represent the continuous predictor (presumably the horizontal "$x$" axis), and the other will represent the dependent variable, which I'm assuming is continuous. If your categorical predictor (moderator) has more than four levels, that might get a little too busy for one plot, but I'm not aware of a better method for such circumstances that doesn't resort to separate plots for each level.
Just to address the following comment:
Here is how to do it in SPSS. I use the
Go to Graph > Legacy > Scatter:
Choose just simple scatter plot is fine. Then, fill in the variables:
You'll then see the scatter plot. Double click on the scatter plot to open the chart editor. At the top, click the icon to "fit lines to subgroups." See pic below:
Now, whether you use the original salary variable as outcome or the predicted salary as outcome adjusted for the other third or more predictors is a matter of your purpose. The original salary will fit better as exploration, while the predicted salary will be more suitable as presenting your regression results.