Dear all,
I tried to run a logit model with an interaction effect which unfortunately does not work due to separation:
I tried to fix that with firthlogit, what actually worked:
However, to be able to interpret the effects more clearly, I would like to generate the marginal effects from this. I therefore tried the margins postestimation command with the option expression(invlogit(predict(xb))) which I found (among others) in this thread. The result is the following:
I'm a little bit confused now about the lack of the interaction effects. How does the command work correctly? Is it correct at all? Which approach do you recommend here?
Thanks for any help!
I tried to run a logit model with an interaction effect which unfortunately does not work due to separation:
Code:
. logit care_benefits c.health_lim##i.onecareperson_3 if valid==1 & onecarepersononly==1 note: 2.onecareperson_3 != 0 predicts failure perfectly 2.onecareperson_3 dropped and 65 obs not used note: 3.onecareperson_3#c.health_lim != 0 predicts failure perfectly 3.onecareperson_3#c.health_lim dropped and 32 obs not used note: 2.onecareperson_3#c.health_lim omitted because of collinearity Iteration 0: log likelihood = -47.883416 Iteration 1: log likelihood = -39.596133 Iteration 2: log likelihood = -35.881327 Iteration 3: log likelihood = -35.798874 Iteration 4: log likelihood = -35.798488 Iteration 5: log likelihood = -35.798488 Logistic regression Number of obs = 320 LR chi2(2) = 24.17 Prob > chi2 = 0.0000 Log likelihood = -35.798488 Pseudo R2 = 0.2524 ---------------------------------------------------------------------------------------------- care_benefits | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------------------+---------------------------------------------------------------- health_lim | .3637094 .085982 4.23 0.000 .1951877 .532231 | onecareperson_3 | wider family | 0 (empty) not family | -.3931463 1.182315 -0.33 0.739 -2.710441 1.924148 | onecareperson_3#c.health_lim | wider family | 0 (empty) not family | 0 (omitted) | _cons | -4.360444 .6238969 -6.99 0.000 -5.583259 -3.137628 ----------------------------------------------------------------------------------------------
Code:
. firthlogit care_benefits c.health_lim##i.onecareperson_3 if valid==1 & onecarepersononly==1 initial: penalized log likelihood = -45.352147 rescale: penalized log likelihood = -45.352147 Iteration 0: penalized log likelihood = -45.352147 Iteration 1: penalized log likelihood = -32.617258 Iteration 2: penalized log likelihood = -31.545871 Iteration 3: penalized log likelihood = -31.462159 Iteration 4: penalized log likelihood = -31.4621 Iteration 5: penalized log likelihood = -31.4621 Number of obs = 417 Wald chi2(5) = 27.73 Penalized log likelihood = -31.4621 Prob > chi2 = 0.0000 ---------------------------------------------------------------------------------------------- care_benefits | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------------------+---------------------------------------------------------------- health_lim | .3502754 .0817553 4.28 0.000 .190038 .5105129 | onecareperson_3 | wider family | -.6839636 1.635612 -0.42 0.676 -3.889704 2.521777 not family | -.4077488 1.045765 -0.39 0.697 -2.457411 1.641913 | onecareperson_3#c.health_lim | wider family | -.0106092 .3302318 -0.03 0.974 -.6578516 .6366332 not family | -.0372747 .3046006 -0.12 0.903 -.634281 .5597315 | _cons | -4.206488 .5869453 -7.17 0.000 -5.356879 -3.056096 ----------------------------------------------------------------------------------------------
Code:
. margins, dydx(*) expression(invlogit(predict(xb))) Average marginal effects Number of obs = 417 Model VCE : OIM Expression : invlogit(predict(xb)) dy/dx w.r.t. : health_lim 2.onecareperson_3 3.onecareperson_3 --------------------------------------------------------------------------------- | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] ----------------+---------------------------------------------------------------- health_lim | .0091291 .002512 3.63 0.000 .0042057 .0140525 | onecareperson_3 | wider family | -.0174202 .0227347 -0.77 0.444 -.0619794 .0271389 not family | -.014628 .0252153 -0.58 0.562 -.0640492 .0347931 --------------------------------------------------------------------------------- Note: dy/dx for factor levels is the discrete change from the base level.
Thanks for any help!
Comment