Hello,

Using the user-written khb command by Ulrich Kohler and Kristian Karlson, I have decomposed the effect of a binary variable (x) on a categorical (unordered) outcome (y) using a categorical (ordered) mediating variable (m).

I would like to plot the indirect, direct and total effects (I have attached an example where ACME is the indirect effect, ADE is the direct followed by the total effect). I am trying to store the estimates from the khb output and then use coefplot to achieve what I need.

This is the decomposition for category 3 of my outcome with 0 as the base outcome. I attempt to store the coefficients and confidence intervals so that I can plot them:
Code:
khb mlogit y i.x || i.m, outcome(3) baseoutcome(0)  c( goveducCH2 govempCH2 ) disentangle

Decomposition using the KHB-Method

Model-Type:  mlogit                                Number of obs     =    5567
Variables of Interest: i.x                         Pseudo R2         =    0.04
Z-variable(s): i.m
Concomitant: goveducCH2 govempCH2
Results for outcome 3 and base outcome Consistently_unemployed
------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
0.x          |  (base outcome)
-------------+----------------------------------------------------------------
1.x          |
     Reduced |    .893427   .1067596     8.37   0.000      .684182    1.102672
        Full |   .7119227   .1079495     6.59   0.000     .5003455    .9234999
        Diff |   .1815043   .0248776     7.30   0.000     .1327452    .2302635
------------------------------------------------------------------------------

Components of Difference

      Z-Variable |      Coef    Std_Err     P_Diff  P_Reduced  
    -------------+---------------------------------------------
    0b.x         |                                             
           _i_m2 |         0          0          .          .  
           _i_m3 |         0          0          .          .  
           _i_m4 |         0          0          .          .  
    1.x          |                                             
           _i_m2 |  .0499166   .0162951      27.50       5.59  
           _i_m3 |  .0909348   .0190041      50.10      10.18  
           _i_m4 |   .040653   .0195628      22.40       4.55  
    -----------------------------------------------------------

. 
. ereturn list 

scalars:
                  e(N) =  5567

macros:
              e(title) : "Decomposition"
      e(mediator_vars) : "_i_m2 _i_m3 _i_m4"
           e(key_vars) : "i.x"
             e(depvar) : "y"
             e(method) : "KHB"
              e(model) : "mlogit"
                e(cmd) : "khb"
         e(properties) : "b V"

matrices:
                  e(b) :  1 x 6
                  e(V) :  6 x 6
             e(Diff_V) :  2 x 2
              e(SUR_b) :  1 x 15
              e(SUR_V) :  15 x 15
             e(Full_b) :  1 x 8
             e(Full_V) :  8 x 8
          e(Reduced_b) :  1 x 8
          e(Reduced_V) :  8 x 8
        e(disentangle) :  6 x 4

functions:
             e(sample)   

. 
. estimates store khb 

. 
. coefplot _est_khb
estimation result _est_khb not found
I understand that estimation commands store their results in the e( ) returns so I am not sure why I am getting the error message “estimation result not found” if ereturn list shows that there are estimates stored.

(In the khb output, reduced = total effect, full = direct and diff = indirect effect)

Array