Grad Fellow Notes: STATA’s Command -coefplot-


By Andre Lee (Georgetown MIDP 18)

The coefplot command allows you to plot results from estimation commands. It is a user package, so you will have to find and install it by inputting into the Stata command line:

findit coefplot

Click on the coefplot install link.

Now, using the auto database, I made a simple regression and store it in memory as model_1:

sysuse auto

regress price gear_ratio mpg rep78 turn weight trunk

estimates store model_1

model_1’s coefficients can now be plotted with:

coefplot model_1, drop(_cons) xline(0)

I can also graphically compare the coefficients and confidence intervals for each independent variable used in the models:

regress price gear_ratio mpg rep78 turn weight headroom

estimates store model_2

coefplot model_1 model_2, drop(_cons) xline(0)

I can also separate the predictor variables into individual graphs:

coefplot model_1 || model_2, yline(0) bycoefs vertical byopts(yrescale) ylabel(, labsize(vsmall)) 

Full credit goes to Jeff Meyer who created many tutorials in the website:

The information was sifted from his various article on useful Stata commands and adapted for sysuse auto (native database in Stata) for the reader’s ease of use.


Leave a Reply

Your email address will not be published. Required fields are marked *