Dear all,
I want to plot the predicted outcomes of several experimental groups from a linear regression analysis. #
I use -margins- with -at()- to specify the values of interest.
However -coefplot- (SJ, Ben Jann) plots the coefficients of the regression preceding margins and does not plot the value predicted by margins.
-margins- followed by -marginsplots- does plot the desired coefficients but obviously only for one -margins- result at a time.
I have found it that -matrix list r(table)- contains the information I want to plot. But I did not figure out how to tell -coefplot- to use this matrix (and the matrices of the other preceding -margin- commands)
To clarify what I hope for, here is a reproducible example. In my case the explanatory variable are three dichotomous variables for the experimental conditions.
I am grateful for any advice.
I want to plot the predicted outcomes of several experimental groups from a linear regression analysis. #
I use -margins- with -at()- to specify the values of interest.
However -coefplot- (SJ, Ben Jann) plots the coefficients of the regression preceding margins and does not plot the value predicted by margins.
-margins- followed by -marginsplots- does plot the desired coefficients but obviously only for one -margins- result at a time.
I have found it that -matrix list r(table)- contains the information I want to plot. But I did not figure out how to tell -coefplot- to use this matrix (and the matrices of the other preceding -margin- commands)
To clarify what I hope for, here is a reproducible example. In my case the explanatory variable are three dichotomous variables for the experimental conditions.
Code:
sysuse auto, clear ssc install coefplot eststo clear regress mpg foreign turn eststo: margins, at(foreign=0 turn=40) eststo: margins, at(foreign=1 turn=40) eststo: margins, at(foreign=0 turn=41) eststo: margins, at(foreign=1 turn=41) marginsplot //Plots the desired estimated (of the last calculation) coefplot est1 est2 est3 est4 matrix list r(table)
Comment