Announcement

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

  • Difference between -margins, dydx(categorical_variable)- and -margins r.i.categorical_variable- & Margins for multilevel mixed-effects logit

    Hello everyone,

    I am conducting a random-effects logistic regression (-xtlogit-) for a panel-like data structure (-xtset subject period-), in which a have 20 observations per subject. The dependent variable is binary (behavior: 0/1). Between subjects, I have five treatment and one control group (treatment: categorical 1/6) . Furthermore, I have a dispositional personality feature of subjects from a questionnaire (dis: quasi-continuous 1/6).

    I want to "see" the effect of this dispositional personality feature on the behavior in the control group as well as the treatment effect and its interaction with this dispositional feature.

    First, I ran a RE logistic regression and found an effect of some treatments compared to the control group. However, there is no effect of dis overall.

    Code:
    xtset subject period
    xtlogit behavior i.treatment c.dis, cluster(subject)
    Second, I ran a RE logistic regression and found a main and interaction effect of some treatments compared to the control group. I also find an effect of dis in the control group.

    Code:
    xtset subject period
    xtlogit behavior i.treatment##c.dis, cluster(subject)
    Third, to visualize the effect of dis in the control group I did the following:

    Code:
    margins 1.treatment, at(dis(1(1)6))
    Fourth, to visualize the interaction effects of treatments and dis I did the following:

    Code:
    margins, dydx(2.treatment) at(dis(1(1)6))
    margins, dydx(3.treatment) at(dis(1(1)6))
    margins, dydx(4.treatment) at(dis(1(1)6))
    margins, dydx(5.treatment) at(dis(1(1)6))
    margins, dydx(6.treatment) at(dis(1(1)6))
    I used marginsplot to visualize the results. However, I wonder whether the following command is better or worse. It yields almost, but not 100% the same results:

    Code:
    margins r.i.treatment_split if treatment==1 | treatment==2, at(dis(1(1)6))
    margins r.i.treatment_split if treatment==1 | treatment==3, at(dis(1(1)6))
    margins r.i.treatment_split if treatment==1 | treatment==4, at(dis(1(1)6))
    margins r.i.treatment_split if treatment==1 | treatment==5, at(dis(1(1)6))
    margins r.i.treatment_split if treatment==1 | treatment==6, at(dis(1(1)6))
    Do you have any comments regarding my analysis and/or which command (-margins, dydx()- versus -margins r... if,-) you prefer for analyzing the marginal effects at representative values?

    --


    Also, I include this question here as it is based on the same case: In addition to what I described above, I also have a nested data structure. That's why I created a multilevel mixed-effects logistic regression (-melogit-) to back up my results.

    Code:
    melogit behavior i.treatment c.dis, || session: || group: || subject:
    melogit behavior i.treatment##c.dis, || session: || group: || subject:
    However, I was unable to find an "easy" way to replicate my approach from above (marginal effect at representative values in the control group and for treatment groups in contrast to the control group) with a multilevel mixed-effects logistic regression. Do you have any source where I can find an approach of how to do and interpret it?

    --

    Thanks a lot for any help you can provide!
    Kim
Working...
X