Hi,

I am trying to plot the adjusted means (in the form of a bar graph as both predictors are categorical) from a linear regression model.

Say I run the following:

regress y i.a##i.b c.covariable c.covariable i.covariable

The interaction is significant, so therefore I want to plot the adjusted means for each level of a (2-levels) and b (2 levels).

To see the adjusted means, I do:
margins a#b

And to get the individual predicted values I do:

predict predicted_y

I figured the best way to plot bar graphs was using the following code:

cibar predicted_y, over1(a) over2(b)

However, the means on the bar graphs do not match up to the values obtained from margins a#b

Any ideas on why this might be? Or perhaps another way I can directly plot the outcome from the interaction in a bar graph?

Many thanks,
Lucy