I am trying to obtain some simple slopes in exponentiated form for the effect of a continuous variable in two treatment groups. Margins with the predict(xb) option gives the log-odds effects and matches up with that calculated from the regression table. However, when I try to obtain OR's using expression(exp(predict(xb))), it doesn't do what I expect - i.e exp(.0235472) = 1.0238 and exp(-.0385977) = 0.9621.
Am I specifying something incorrectly?
Thanks.
Code:
. logit lapse_first_14_days i.treatment_condition##c.numberofpreviousdetoxes if seq == 1 Iteration 0: log likelihood = -207.77746 Iteration 1: log likelihood = -204.98423 Iteration 2: log likelihood = -204.98247 Iteration 3: log likelihood = -204.98247 Logistic regression Number of obs = 300 LR chi2(3) = 5.59 Prob > chi2 = 0.1334 Log likelihood = -204.98247 Pseudo R2 = 0.0135 --------------------------------------------------------------------------------------------------------------- lapse_first_14_days | Coef. Std. Err. z P>|z| [95% Conf. Interval] ----------------------------------------------+---------------------------------------------------------------- treatment_condition | intervention | -.3104472 .2813866 -1.10 0.270 -.8619548 .2410603 numberofpreviousdetoxes | .0235472 .048203 0.49 0.625 -.070929 .1180233 | treatment_condition#c.numberofpreviousdetoxes | intervention | -.0621448 .0616824 -1.01 0.314 -.18304 .0587504 | _cons | .2476101 .1981055 1.25 0.211 -.1406696 .6358898 --------------------------------------------------------------------------------------------------------------- . margins treatment_condition, dydx(numberofpreviousdetoxes) predict(xb) Average marginal effects Number of obs = 300 Model VCE : OIM Expression : Linear prediction (log odds), predict(xb) dy/dx w.r.t. : numberofpreviousdetoxes ----------------------------------------------------------------------------------------- | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] ------------------------+---------------------------------------------------------------- numberofpreviousdetoxes | treatment_condition | control | .0235472 .048203 0.49 0.625 -.070929 .1180233 intervention | -.0385977 .0384862 -1.00 0.316 -.1140292 .0368339 ----------------------------------------------------------------------------------------- . margins treatment_condition, dydx(numberofpreviousdetoxes) expression(exp(predict(xb))) Average marginal effects Number of obs = 300 Model VCE : OIM Expression : exp(predict(xb)) dy/dx w.r.t. : numberofpreviousdetoxes ----------------------------------------------------------------------------------------- | Delta-method | dy/dx Std. Err. z P>|z| [95% Conf. Interval] ------------------------+---------------------------------------------------------------- numberofpreviousdetoxes | treatment_condition | control | .0323045 .0676398 0.48 0.633 -.1002671 .1648761 intervention | -.033014 .0342515 -0.96 0.335 -.1001457 .0341177 -----------------------------------------------------------------------------------------
0 Response to Margins expression option not working, or am I doing something wrong?
Post a Comment