Why does coefplot not plot all levels of interaction in Stata?

1.2k views Asked by At

I want to plot the coefficients from this regression as a forest plot.

-------------------------------------------------------------------------------
        price | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
--------------+----------------------------------------------------------------
foreign#rep78 |
  Domestic#1  |   -781.769   1013.428    -0.77   0.443    -2805.724    1242.186
   Foreign#0  |  -1529.739   1771.487    -0.86   0.391    -5067.642    2008.164
   Foreign#1  |  -81.34985   848.0347    -0.10   0.924    -1774.992    1612.292
              |
        _cons |   6358.405   485.1416    13.11   0.000     5389.511      7327.3
-------------------------------------------------------------------------------

The forest plot produced by coefplot (community-contributed command) only plots the last coefficient (-81), and not the other coefficients (-782 and -1530). Where am I going wrong?

sysuse auto, clear

recode rep78 (1/3=0) (4/5=1)
    
reg price i.foreign#i.rep78

* Only plots last coefficient (-81)
coefplot, keep(*.foreign#*.rep78) mlabel

* Doesn't work either
coefplot, keep(0.foreign#1.rep78 1.foreign#0.rep78 1.foreign#1.rep78) mlabel
1

There are 1 answers

0
srocco On BEST ANSWER

coefplot automatically excludes coefficients that are flagged as "omitted" or as "base levels"---as in the case of your coefficients. To include all coefficients in the plot, you should specify the "omitted" and "baselevels" options. So it would look like something along these lines:

sysuse auto, clear
recode rep78 (1/3=0) (4/5=1)
reg price i.foreign#i.rep78
coefplot, omitted baselevels mlabel

Some more details on the package are available here: http://repec.sowi.unibe.ch/stata/coefplot/getting-started.html