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
Related Posts with Plotting adjusted means as a bar graph
Stata 16Dear Statalist, I hope this finds you well. I would like to ask regarding the new version of Stata …
Running mi:reshape after imputation (longitudinal dataset)Hi All I imputed (25 imputations) my longitudinal dataset (in the wide format) which seems to have …
Not normally distributed errors after controlling for time fixed effectsHello everyone, I am running a regression where I would like to control for both region and time fix…
test of proportions using prtestHi statalist, I am trying to run a two sample test of proportion using two groups (women who report…
Please help me troubleshoot converting string date("20100201") into the format Stata recognizes as dateHi, I was converting string date data (variable Fdate and Pdate, they look like "20100201") into num…
Subscribe to:
Post Comments (Atom)
0 Response to Plotting adjusted means as a bar graph
Post a Comment