0
$\begingroup$

When I run a simple logit regression between a binary variable $y$ over another binary variable $x$, the average marginal effects obtained by the function logitmfx (from mfx package) are different from those obtained by the function margins (from the eponymous package).

Because there is only one covariate ($x$), this discrepancy cannot be linked to a difference in concepts between average marginal effects (AME) and marginal effects at mean (MEM), as both coincide in this case.

Hence, what explains the gap?

$\endgroup$
1
$\begingroup$

The reason lies in the types of the variables: mfx is insensitive to type, and treats a binary variable as a boolean, even if it is numeric; whereas margins treats differently factors or boolean from numerical variables. In particular, the marginal effect computed for binary numerical variables is the predicted output $y$ when the variable $x$ equals 1 minus the predicted $y$ when $x$ equals its average, instead of subtracting the predicted output at $x=0$, as in mfx or when $x$ is a factor or a boolean. Hence, if you change the types of $x$ and $y$ to logical (or factor), you should retrieve the results of mfx.

To conclude, the most intuitive and consistent definition is probably the one of mfx.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.