Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Export marginal effects after multiple imputation into Word

    Hey,

    I need to export average marginal effects into Word after performing a logistic regression on multiple imputed data. Unfortunately, my command returns an error (see below). How to do it using outreg2?

    Code:
    . ssc install dataex
    checking dataex consistency and verifying not already installed...
    all files already exist and are up to date.
    
    . do "C:\Users\sofiy\AppData\Local\Temp\STD33a4_000000.tmp"
    
    . eststo raw: mi estimate: logit W1ExcludeYP i.W1ethgrpYP i.W1truantYP substance_use de
    > linquency if mysample & !miss_W1ExcludeYP [pweight = Designweight], vce (cluster Samp
    > PSU) // Model 1
    
    Multiple-imputation estimates                   Imputations       =         20
    Logistic regression                             Number of obs     =      8,463
                                                    Average RVI       =     0.0000
                                                    Largest FMI       =     0.0000
    DF adjustment:   Large sample                   DF:     min       =   1.15e+62
                                                            avg       =   2.30e+63
                                                            max       =          .
    Model F test:       Equal FMI                   F(  10, 1.7e+64)  =      65.41
    Within VCE type:       Robust                   Prob > F          =     0.0000
    
                                     (Within VCE adjusted for 653 clusters in SampPSU)
    ----------------------------------------------------------------------------------
         W1ExcludeYP |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -----------------+----------------------------------------------------------------
          W1ethgrpYP |
              Mixed  |   .4074894   .2150833     1.89   0.058    -.0140662    .8290449
             Indian  |  -.4759696   .2147936    -2.22   0.027    -.8969574   -.0549818
          Pakistani  |   .0889078   .2414541     0.37   0.713    -.3843336    .5621491
        Bangladeshi  |  -.8441511   .4575192    -1.85   0.065    -1.740872    .0525701
    Black Caribbean  |   .9121191   .2035089     4.48   0.000     .5132491    1.310989
      Black African  |   .3454964   .3128541     1.10   0.269    -.2676863    .9586791
              Other  |   .2748554   .3371221     0.82   0.415    -.3858918    .9356026
                     |
          W1truantYP |
            Truancy  |   1.147681   .1133011    10.13   0.000     .9256154    1.369747
       substance_use |   .4450888   .0915578     4.86   0.000     .2656389    .6245387
         delinquency |    .385857   .0706877     5.46   0.000     .2473117    .5244024
               _cons |  -3.736188   .1651341   -22.63   0.000    -4.059845   -3.412531
    ----------------------------------------------------------------------------------
    
    .  mimrgns, dydx (*) predict(pr) // exporting into Word
    
    Multiple-imputation estimates                   Imputations       =         20
    Average marginal effects                        Number of obs     =      8,463
                                                    Average RVI       =     0.0000
                                                    Largest FMI       =     0.0000
    DF adjustment:   Large sample                   DF:     min       =   7.37e+61
                                                            avg       =   7.37e+61
    Within VCE type: Delta-method                           max       =          .
    
    Expression   : Pr(W1ExcludeYP), predict(pr)
    dy/dx w.r.t. : 2.W1ethgrpYP 3.W1ethgrpYP 4.W1ethgrpYP 5.W1ethgrpYP 6.W1ethgrpYP 7.W1eth
    > grpYP 8.W1ethgrpYP 1.W1truantYP substance_use delinquency
    
    ----------------------------------------------------------------------------------
                     |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -----------------+----------------------------------------------------------------
          W1ethgrpYP |
              Mixed  |   .0333799   .0198794     1.68   0.093    -.0055831    .0723428
             Indian  |  -.0286248   .0110681    -2.59   0.010     -.050318   -.0069317
          Pakistani  |   .0065168   .0182003     0.36   0.720    -.0291551    .0421888
        Bangladeshi  |  -.0446876   .0175391    -2.55   0.011    -.0790636   -.0103117
    Black Caribbean  |   .0887573    .025206     3.52   0.000     .0393545    .1381602
      Black African  |   .0276987    .027965     0.99   0.322    -.0271118    .0825091
              Other  |   .0214998   .0288044     0.75   0.455    -.0349558    .0779554
                     |
          W1truantYP |
            Truancy  |   .1109715   .0142472     7.79   0.000     .0830474    .1388955
       substance_use |   .0320978   .0066454     4.83   0.000     .0190731    .0451226
         delinquency |   .0278263    .005118     5.44   0.000     .0177952    .0378574
    ----------------------------------------------------------------------------------
    Note: dy/dx for factor levels is the discrete change from the base level.
    
    
    . outreg2 margin using gor.doc
    matrix e(b) not found; run/post a regression, or specify varlist for non-regression out
    > puts
    r(111);

  • #2
    mimrgns (probably from SSC or GitHub) and outreg2 (probably from SSC) are both community-contributed commands.

    There are alternatives to outreg2; you could also specify the post option to force mimrgns to post results to e().

    Comment


    • #3
      Originally posted by daniel klein View Post
      mimrgns (probably from SSC or GitHub) and outreg2 (probably from SSC) are both community-contributed commands.

      There are alternatives to outreg2; you could also specify the post option to force mimrgns to post results to e().
      Thank you, Daniel. Figured it out now!
      Last edited by Sofiya Volvakova; 11 Mar 2024, 15:04.

      Comment

      Working...
      X