I have been attempting to compare the two items in a margins output table (calculated at a specific point for a continuous predictor), but instead of giving me the a difference between the items in the margins table, it gives me a main effect from the original regression, and not anything from the margins table.
Any thoughts on what I am doing wrong here?
Thanks
. logistic drug i.phase##c.yrmth if Site==3, cluster(docpid) or
Logistic regression Number of obs = 4,561
Wald chi2(3) = 16.40
Prob > chi2 = 0.0009
Log pseudolikelihood = -1757.5682 Pseudo R2 = 0.0092
(Std. Err. adjusted for 1,387 clusters in docpid)
-------------------------------------------------------------------------------
| Robust
drug | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
--------------+----------------------------------------------------------------
2.phase | .2699855 .1397275 -2.53 0.011 .0979067 .7445067
yrmth | .9442172 .0192642 -2.81 0.005 .907205 .9827396
|
phase#c.yrmth |
2 | 1.077845 .0290507 2.78 0.005 1.022385 1.136314
|
_cons | .2849457 .0561262 -6.37 0.000 .1936866 .4192034
-------------------------------------------------------------------------------
Note: _cons estimates baseline odds.
. margins i.phase, at(yrmth=36)
Adjusted predictions Number of obs = 4,561
Model VCE : Robust
Expression : Pr(drug), predict()
at : yrmth = 36
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
phase |
0 | .0348301 .0203622 1.71 0.087 -.0050791 .0747394
2 | .1264737 .0189948 6.66 0.000 .0892445 .1637029
------------------------------------------------------------------------------
. nlcom (risk_diff: _b[2.phase] - _b[0.phase])
risk_diff: _b[2.phase] - _b[0.phase]
------------------------------------------------------------------------------
drug | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
risk_diff | -1.309387 .5175368 -2.53 0.011 -2.323741 -.2950334
------------------------------------------------------------------------------
.
0 Response to Using nlcom and lincom after margins
Post a Comment