Simple question here and I feel really foolish for not being able to figure this out on my own.

I ran a simple linear regression with a continuous DV, two focal IVs (one dichotomous and one continuous) and controls. I have a significant interaction and graphed it with a scatterplot using the predicted values on the Y and the continuous IV on the X and added the two fit lines at the subgroups for the dichotomous IV. SPSS gave a y = a + bx for each fitted line.

My question: when I use the coefficients in excel and graph the interaction, the graph looks similar but the slope values for the continuous IV are different. They are not similar. I've tried different calculations, so it is not user error. Why would these slopes look different than the ones provided in the scatterplot graph created by SPSS? I've also ran separate regressions for each subgroup, hoping that would help, but the coefficients are still different. They look similar to my calculated ones, but still a little off. What am I doing wrong here???

I'm attaching an image of the scatter with the fit lines at subgroups. Thank you in advance, I've been trying to find a good source to reconcile the difference but can't find one at all. I really just need to know which slopes to report with their p-values, and which slopes to use for my graph in excel. Thanks again to anyone that looks at this! enter image description here


Perhaps the data in Excel are not exactly the same, but I am puzzled why you would not just use the SPSS results. What's the point of trying to replicate in Excel? If you need higher precision for the regression coefficients of the plotted lines, you can generate those directly by selecting out the two samples and running a regular regression.

| cite | improve this answer | |
  • $\begingroup$ Hello! Thanks for the response. I plotted the interaction in excel because I ran two separate regressions for the two samples and my coefficients were not the same as the ones provided by the fit lines. When I separate the sample and ran regressions, I get similar results to the ones from my own calculations. I ran separate regressions so I could get p-values associated with each group's slope. $\endgroup$ – chris Sep 26 '16 at 18:09

I am concerned that you are doing something wrong. Here is an example where I ran two separate regressions, generated a plot, and used Fit Line at Subgroups in the Chart Editor to get two fit lines. The slope coefficients match to the precision displayed in the chart.

select if gender eq 'm'.  
regression /dependent=salary  
/enter educ.

select if gender eq 'f'.  
regression /dependent=salary  
/enter educ.  

compute pred = pre_1.
if missing(pred) pred = pre_2.

variable level educ(scale).  
* Chart Builder.  
  SOURCE: s=userSource(id("graphdataset"))  
  DATA: educ=col(source(s), name("educ"))  
  DATA: pred=col(source(s), name("pred"))  
  DATA: gender=col(source(s), name("gender"), unit.category())  
  GUIDE: axis(dim(1), label("Educational Level (years)"))  
  GUIDE: axis(dim(2), label("pred"))  
  GUIDE: legend(aesthetic(aesthetic.color.exterior), label("Gender"))  
  SCALE: linear(dim(2), include(0))  
  SCALE: cat(aesthetic(aesthetic.color.exterior), include("f", "m"))  
  ELEMENT: point(position(educ*pred), color.exterior(gender))  

What was the regression equation you actually ran? Did you have the interaction terms and both of the interacted variables in it along with the controls? If you ran separate regressions, your other control variables would have different coefficients in the two equations.

| cite | improve this answer | |
  • $\begingroup$ I ran a regression with my two focal variables and controls, then another with the interaction term included. Both the interacted variables were included in the model with the interaction term. When I run the model, I save the unstandardized predicted values from the interaction model. Then I use the scatter plot with the predicted values on Y, the continuous IV on X, and markers are set by the dichotomous IV. From that plot I get a+bx for each subgroup. The problem is, when I run separate models for each subgroup, the coefficients for the continuos IV are different. They are cut in half. $\endgroup$ – chris Sep 27 '16 at 0:24
  • $\begingroup$ I used your code. I get the same graph that I am already getting with the same equations for the subgroups. But the output for the separate regressions do not give the same coefficients. $\endgroup$ – chris Sep 27 '16 at 0:29
  • $\begingroup$ Let's see if I am interpreting this correctly. In the full model (with interaction) the coefficient for the continuous IV is the slope for the group = 0. The coefficient for the continuous IV + the interaction coefficient is the slope for the group = 1. $\endgroup$ – chris Sep 27 '16 at 0:58
  • $\begingroup$ But you said that you have other regressors in the equation. They will have different coefficients in the two separate equations. $\endgroup$ – JKP Sep 27 '16 at 21:43
  • $\begingroup$ Thanks for the help. I am going to go with my calculations in the excel sheet and not trust these slope estimates. It doesn't look like these control for the effects of other variables, but the equations derived with the coefficients will control for those effects. Otherwise the predicted dots would line up better with the fit lines. But thank you so much for the help, I really appreciate it! $\endgroup$ – chris Sep 28 '16 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.