 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: Negative probabilities after a margins command for a categorical variable (post logistic model).

 From "Scheetz, Marc" To "statalist@hsphsun2.harvard.edu" Subject st: Negative probabilities after a margins command for a categorical variable (post logistic model). Date Mon, 14 Oct 2013 14:02:57 +0000

```Dear Listserv,

I am reposting a question from last week in hopes of receiving a response.  This is my first content post to the listserv; I appreciate your consideration.  Please let me know if I violated any rules for posting.

I am wondering if anyone can help explain the scenario below to me.  I am running Stata IC v13.0.  I am using the margins command after a multivariate-logistic model with the outcome of "died".  I am attempting to characterize the probabilities of death according to each categorical increase of the variable "log2X".  The referent category below is 2^0=1.  I have modeled the variable as categorical since I lose power due to uneven sample size in some of the categories.

My question is that I receive 95% CIs that have negative margins in  2 of the categories (i.e. 2._at: log2X=1, 4._at:log2X= 3).

Perhaps this is  a rudimentary question, but I thought that probabilities calculated from Odds Ratios could not be negative.  Is this because it is a probability relative to the referent category?  Do you see other errors in my syntax (below)?  Sincerely,

Marc Scheetz, PharmD, MSc

. logistic died i.log2X a2_day0 log10_days_to_pos_cx
note: 4.log2X != 0 predicts failure perfectly
4.log2X dropped and 5 obs not used

note: 5.log2X != 0 predicts failure perfectly
5.log2X dropped and 3 obs not used

Logistic regression                               Number of obs   =         83
LR chi2(6)      =      18.58
Prob > chi2     =     0.0049
Log likelihood = -35.358908                       Pseudo R2       =     0.2081

--------------------------------------------------------------------------------------
died | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
---------------------+--------------------------------------------------
log2X       |
1  |   .7903086     .92746    -0.20   0.841     .0792275    7.883466
2  |   6.471551   5.420137     2.23   0.026     1.253427    33.41317
3  |   1.587899   1.492738     0.49   0.623     .2515548    10.02335
4  |          1  (empty)
5  |          1  (empty)
6  |   6.542207   6.159993     1.99   0.046     1.033362    41.41868
|
a2_day0 |   1.075268   .0732118     1.07   0.286     .9409374    1.228775
log10_days_to_pos_cx |   4.854903   3.054503     2.51   0.012      1.41462    16.66177
_cons |    .012261   .0189665    -2.85   0.004     .0005913    .2542394

. margins, at(log2X=(0(1)6))

Predictive margins                                Number of obs   =         83
Model VCE    : OIM

Expression   : Pr(died), predict()

1._at        : log2X     =           0

2._at        : log2X     =           1

3._at        : log2X     =           2

4._at        : log2X     =           3

5._at        : log2X     =           4

6._at        : log2X     =           5

7._at        : log2X     =           6

------------------------------------------------------------------------------
|            Delta-method
|     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------
_at |
1  |   .1518137   .0514472     2.95   0.003     .0509791    .2526484
2  |   .1259233   .1108515     1.14   0.256    -.0913416    .3431883
3  |   .4764486   .1462235     3.26   0.001     .1898558    .7630413
4  |   .2137861   .1241819     1.72   0.085    -.0296061    .4571782
5  |          .  (not estimable)
6  |          .  (not estimable)
7  |   .4787175   .1765856     2.71   0.007      .132616     .824819
------------------------------------------------------------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```