Announcement

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

  • mimrgns and emargins - average marginal effects the same as coefficient values

    Dear all,

    I have run a logistic regression model on mi data and now I would like to get average marginal effects.

    I have tried using both the mimrgns command and the emargins program, but both of these return average marginal effects values that are the same as the original coefficient values. Please see my code and output below:

    1. Example with mimrgns:

    mi estimate: logit th ib2.cohort i.fert c.stat c.edu i.sex1
    Output:
    th Coef. Std. Err. t P [95% Conf. Interval]
    cohort (ref 2)
    1. Cohort1 -.0611989 .0289399 -2.11 0.036 -.1182399 -.004158
    3. Cohort 3 .6489638 .0336769 19.27 0.000 .5825208 .7154069
    fert (ref 1)
    2. -.3343231 .0612948 -5.45 0.000 -.4555199 -.2131262
    3. -.3815099 .077192 -4.94 0.000 -.5355125 -.2275072
    4. -.5661 .0702629 -8.06 0.000 -.7053152 -.4268849
    5. -.5632703 .069933 -8.05 0.000 -.7020042 -.4245364
    6. -.7277115 .0733454 -9.92 0.000 -.8734783 -.5819447
    7. -.9045366 .0735842 -12.29 0.000 -1.050667 -.7584065
    stat .8950652 .0698831 12.81 0.000 .7563983 1.033732
    edu .9673386 .0453642 21.32 0.000 .877517 1.05716
    1.sex1 .1226577 .0234141 5.24 0.000 .0765511 .1687643
    _cons .4311072 .077804 5.54 0.000 .2770226 .5851919
    mimrgns, dydx(cohort fert stat edu sex1)
    Output:
    Multiple-imputation estimates Imputations = 20
    Average marginal effects Number of obs = 52,537
    Average RVI = 0.5409
    Largest FMI = 0.5388
    DF adjustment: Large sample DF: min = 68.78
    avg = 134.24
    Within VCE type: Delta-method max = 258.53
    Expression : Linear prediction (log odds), predict(xb)
    dy/dx w.r.t. : 1.cohort 3.cohort 2.fert 3.fert 4.fert 5.fert 6.fert 7.fert stat edu..
    dy/dx Std. Err. t P>t [95% Conf. Interval]
    cohort
    1. Cohort 1 -.0611989 .0289399 -2.11 0.036 -.1182399 -.004158
    3. Cohort 3 .6489638 .0336769 19.27 0.000 .5825208 .7154069
    fert
    2. -.3343231 .0612948 -5.45 0.000 -.4555199 -.2131262
    3. -.3815099 .077192 -4.94 0.000 -.5355125 -.2275072
    4. -.5661 .0702629 -8.06 0.000 -.7053152 -.4268849
    5. -.5632703 .069933 -8.05 0.000 -.7020042 -.4245364
    6. -.7277115 .0733454 -9.92 0.000 -.8734783 -.5819447
    7. -.9045366 .0735842 -12.29 0.000 -1.050667 -.7584065
    stat .8950652 .0698831 12.81 0.000 .7563983 1.033732
    edu .9673386 .0453642 21.32 0.000 .877517 1.05716
    1.sex1 .1226577 .0234141 5.24 0.000 .0765511 .1687643


    2. Example with emargins:

    program emargins, eclass properties(mi)
    version 12
    args outcome
    logit th ib2.cohort i.fert c.stat c.edu i.sex1
    margins, dydx(cohort fert stat edu sex1)
    end
    mi estimate, cmdok: emargins 1


    Output:
    Multiple-imputation estimates Imputations = 20
    Logistic regression Number of obs = 51,576
    Average RVI = 0.5032
    Largest FMI = 0.5284
    DF adjustment: Large sample DF: min = 71.54
    avg = 138.78
    max = 239.46
    Model F test: Equal FMI F( 11, 1732.8) = 308.70
    Within VCE type: OIM Prob > F = 0.0000
    th Coef. Std. Err. t P>t [95% Conf. Interval]
    cohort
    1. Cohort1 -.0625422 .0291314 -2.15 0.033 -.119964 -.0051203
    3. Cohort3 .6486531 .0335712 19.32 0.000 .5824863 .7148199
    fert
    2. -.3334438 .0601941 -5.54 0.000 -.4522741 -.2146135
    3. -.3806243 .0770744 -4.94 0.000 -.5342863 -.2269623
    4. -.5691863 .0703006 -8.10 0.000 -.7084076 -.4299649
    5. -.5655533 .0698688 -8.09 0.000 -.704074 -.4270326
    6. -.7310476 .0739668 -9.88 0.000 -.8780468 -.5840485
    7. -.9087949 .0740891 -12.27 0.000 -1.055914 -.7616757
    stat .8871267 .0699085 12.69 0.000 .7484814 1.025772
    edu .9617701 .0448082 21.46 0.000 .8731478 1.050392
    sex1
    2. Female .1203853 .0237677 5.07 0.000 .0735649 .1672058
    _cons .4392243 .0789807 5.56 0.000 .2827478 .5957008
    Please can anyone advise on why this command does not appear to be working?

    Thank you in advance.


    Mollie Bourne
    Last edited by Mollie Bourne; 25 Aug 2016, 03:19.

  • #2
    First, note that the two approaches yield different results! The reported sample size does also differ. You need to address these issues.

    The second approach should be expected to be the same as the original coefficients, because you omit the post option in the margins call in your emargins program. This way, mi reports the combined results from logit. Adding the post option will yield (average) marginal effects in terms of probabilities - the default after logit.

    The mimrgns command (from SSC) reports (average) marginal effects in terms of the linear predictor, as you can clearly see in the output, stating

    Code:
    Expression : Linear prediction (log odds), predict(xb)
    The help file explains why this is the case and how you can get predicted probabilities. I suggest you read the help carefully, then code

    Code:
    mimrgns , dydx(cohort fert stat edu sex) predict(pr)
    Best
    Daniel

    Edit:
    Please use code delimiters to post results.
    Last edited by daniel klein; 25 Aug 2016, 04:08.

    Comment


    • #3
      Great - thank you very much!

      Comment


      • #4
        daniel klein Do I understand correctly that
        Code:
        mimrgns , dydx(cohort fert stat edu sex) predict(pr)
        does the same thing in case of imputed data as
        Code:
        margins if e(sample), dydx(cohort fert stat edu sex) post
        after a normal probit command? Or is it necessary to use the -predict-option in case of the margins command as well?

        Comment


        • #5
          It is never a problem to explicitly specify the predict() option. It also makes the code more readable. If you omit the option, margins' default prediction depends on the last estimation command. After probit, margins default to predict(pr).

          Comment

          Working...
          X