Announcement

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

  • mibeta command and statistical output

    Dear Stata Community:

    I am trying to ascertain the following statistical outcomes, including R^2, F, etc. after the mibeta regression. Can anyone help with my coding error below.
    Appreciate anyone's thoughts-
    Pat

    . mibeta ZMATH ib3.MOMDEG [pweight=W1P0]
    . outreg2 using regression.xls, replace excel dec(2) alpha(0.001, 0.01, 0.05) addstat( ///
    > dfModel, e(df_m_mi), dfError, e(df_r_mi), F, e(F_mi), R2, e(r2_mi)

    matrix e(b) not found; run/post a regression, or specify varlist for non-regression outputs
    r(111);

    end of do-file

  • #2
    You do not specify where mibeta is from and you lack a reproducible example. The command is from Stata Journal by Yulia Marchenko and here is an example of the output.

    Code:
    sysuse auto
    mi set mlong
    mi register imputed rep78
    mi impute mlogit rep78 mpg weight length price turn trunk, add(5) rseed(231729)
    *Fit linear regression model to imputed data and obtain standardized coefficients
    mibeta mpg weight length i.rep78
    I see two tables and statistics at the bottom. What exactly do you need to extract?

    Code:
    . mibeta mpg weight length i.rep78
    
    Multiple-imputation estimates                   Imputations       =          5
    Linear regression                               Number of obs     =         74
                                                    Average RVI       =     0.0263
                                                    Largest FMI       =     0.0970
                                                    Complete DF       =         67
    DF adjustment:   Small sample                   DF:     min       =      52.34
                                                            avg       =      59.22
                                                            max       =      64.92
    Model F test:       Equal FMI                   F(   6,   64.7)   =      23.98
    Within VCE type:          OLS                   Prob > F          =     0.0000
    
    ------------------------------------------------------------------------------
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
          weight |  -.0028379   .0016612    -1.71   0.092    -.0061557    .0004799
          length |   -.097916   .0562784    -1.74   0.087    -.2103143    .0144824
                 |
           rep78 |
              2  |  -.0827336    2.60311    -0.03   0.975    -5.295529    5.130062
              3  |  -.6184872   2.388466    -0.26   0.797    -5.402655    4.165681
              4  |  -.5727751   2.473571    -0.23   0.818    -5.535595    4.390045
              5  |   2.234269   2.563839     0.87   0.387    -2.904531    7.373069
                 |
           _cons |   48.32177   6.465051     7.47   0.000     35.40862    61.23492
    ------------------------------------------------------------------------------
    
    Standardized coefficients and R-squared
    Summary statistics over 5 imputations
    
                 |       mean       min        p25     median        p75       max
    -------------+----------------------------------------------------------------
          weight |  -.3812313     -.394  -.3936288  -.3746896  -.3737662      -.37
          length |  -.3768436     -.387  -.3821648  -.3820722   -.367529     -.365
                 |
           rep78 |
              2  |  -.0043114    -.0554  -.0075797  -.0051404   .0114916     .0351
              3  |  -.0531988     -.124  -.0637297  -.0493614  -.0435566     .0149
              4  |  -.0439306     -.117  -.0523171  -.0512322  -.0288462       .03
              5  |   .1442454     .0823   .1406105   .1475846   .1485822      .202
    -------------+----------------------------------------------------------------
        R-square |    .689109      .688    .687761   .6898957   .6900493       .69
    Adj R-square |    .661268       .66   .6597993   .6621252   .6622926      .662
    ------------------------------------------------------------------------------

    Comment


    • #3
      Andrew: Thank you so much for your response. I did see Yulia Marchenko's post together with a number of others in the FAQ section, but none seem to answer my question. I have successfully used the following command in Stata 15 to run a regression analysis with imputed data:

      .mi estimate, dots post: reg ZMATH ib3.MOMDEG [pweight=W1P0]
      outreg2 using regression.xls, replace excel dec(2) alpha(0.001, 0.01, 0.05) addstat( ///
      dfModel, e(df_m_mi), dfError, e(df_r_mi), F, e(F_mi))

      I am also separately running the same regression this time using -mibeta for the sole purpose of getting R2 results as follows:

      .mibeta ZMATH ib3.MOMDEG [pweight=W1P0]

      My question is whether or not there is a way to combine the mi estimate and the mibeta command together to get all of the results in a table using outreg2.
      For example, I would like to have:
      outreg2 using regression.xls, replace excel dec(2) alpha(0.001, 0.01, 0.05) addstat( ///
      dfModel, e(df_m_mi), dfError, e(df_r_mi), F, e(F_mi)) ......PLUS......... (R2, e(r2_mi) in my output

      I appreciate your help-
      Best,
      Pat

      Comment


      • #4
        Code:
        *RUN mibeta TO PICK OUT STATS
        mibeta ZMATH ib3.MOMDEG [pweight=W1P0]
        *R2
        local r2mi= e(r2_mi)
        *ADJ. R2
        local ar2mi= e(r2_adj_mi)
        
        *RUN YOUR COMMAND
        mi estimate, dots post: reg ZMATH ib3.MOMDEG [pweight=W1P0]
        
        *OUTPUT USING OUTREG2
        outreg2 using regression.xls, replace excel dec(2) ///
        alpha(0.001, 0.01, 0.05) addstat( dfModel, e(df_m_mi), dfError, ///
        e(df_r_mi), F, e(F_mi), R-squared, `r2mi', Adjusted R-squared, `ar2mi')
        Typically, you will not want to report both the R2 and Adjusted R2 in the same table, so pick one. I present both here to illustrate the method. The estimation results are stored in e following most estimation commands in Stata, so you can run

        Code:
        ereturn list
        to access them and store what you want in a local macro as I have done above. Finally, because you are using MI, it is important to mention that the reported R2 statistic is the average from estimations over the imputed data sets.

        Comment


        • #5
          Andrew:
          Yes, I understand. This worked perfectly. Thank you so much for your help!
          Best,
          Pat

          Comment

          Working...
          X