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
mimrgns, dydx(cohort fert stat edu sex1)
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:
Please can anyone advise on why this command does not appear to be working?
Thank you in advance.
Mollie Bourne
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 |
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 |
Thank you in advance.
Mollie Bourne
Comment