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
Inconsistent results between xtpoisson and marginsHi Statalisters, I am using -xtpoisson,fe- count data model to analyze my panel data. The dependent…
How to find the mean of subset of individualsI have data from several thousand observations on education level (discrete variable that ranges fro…
Large coefficients for FE, POLS and REGood day to you I am estimating Tanzania export performance using gravity model , and my coefficient…
How to apply maximum value to a whole group using StataHello, I want to generate a variable (max_count) wherein, for a given group ID, if the value of "co…
Split string variables into different partsHi, I am using Stata 16 and would need some help in splitting a string variable and destring the va…
Subscribe to:
Post Comments (Atom)
0 Response to Plotting adjusted means as a bar graph
Post a Comment