Hello all,
I'm wrestling with a problem of how to plot marginal effects from a binary logistic regression, that includes an interaction. I'm sure I'm making some mistakes at the end of a long day, but here is my attempt so far and why I'm facing a problem. I am trying to do similar to the graphs posted below from this article, but the code is different enough that I can't simply replicate the author's.
Both variables in the interaction are binary.
The problem is this does not give me the interaction effect when graphed, as is my goal and as the author does in the graphs posted.
I can do it in two steps:
But this then gives me an ugly graph (i.e, different colours for the different models), and I'm not sure whether it is statistically sound.
Ideally I would like to have similar to the below, where you can see the interaction effects in the first four rows.
Thanks in advance.
I'm wrestling with a problem of how to plot marginal effects from a binary logistic regression, that includes an interaction. I'm sure I'm making some mistakes at the end of a long day, but here is my attempt so far and why I'm facing a problem. I am trying to do similar to the graphs posted below from this article, but the code is different enough that I can't simply replicate the author's.
Both variables in the interaction are binary.
Code:
logit dv iv1 iv2 iv3 i.iv4 i.iv5 i.iv4##i.v5 margins, dydx(*) predict(pr) post coefplot, drop(_cons) xline(0)
I can do it in two steps:
Code:
logit dv iv1 iv2 iv3 i.iv4 i.iv5 i.iv4##i.v5 margins, dydx(*) predict(pr) post estimates store m1 logit dv iv1 iv2 iv3 i.iv4 i.iv5 i.iv4##i.v5 margins, dydx(iv4) at(iv5=(0 1)) post estimates store m2 coefplot (m1) (m2), drop(_cons) xline(0)
Ideally I would like to have similar to the below, where you can see the interaction effects in the first four rows.
Thanks in advance.
Comment