Announcement

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

  • Interpreting confidence intervals of predictive margins after logit

    Hello all,

    I have a logistic regression model including an interaction term between two categorical variables (sex and race). I am using population representative data. The output (slightly edited for readability) is pasted below. My question is: How do I interpret the 95% CIs that cross 0? My understanding is that marginal predictions after logistic regression are interpreted as predicted probabilities, so I was expecting to see CIs constrained to be between 0 and 1.

    Code:
    . margins sex#race4, vce(unconditional)
    
    Predictive margins
    
    Number of strata =  76                            Number of obs   =    2,389
    Number of PSUs   = 843                            Population size =    2,352.5017
    Design df       =    767
    
    Expression: Pr(outcome), predict()
    
            
    Linearized
    Margin   std. err.      t    P>t    [95% conf.    interval]
            
    
          0. Male   #1. White  |   .0477874   .0066719     7.16   0.000     .0346899    .0608848
          0. Male   #2. Black  |   .0869118   .0247047     3.52   0.000      .038415    .1354086
       0. Male   #3. Hispanic  |   .0127917   .0088384     1.45   0.148    -.0045588    .0301421
    0. Male   #4. Other/Multi  |   .0740847   .0329425     2.25   0.025     .0094165     .138753
           1. Female#1. White  |   .0840895   .0160033     5.25   0.000      .052674     .115505
           1. Female#2. Black  |   .0266466   .0174556     1.53   0.127    -.0076199     .060913
        1. Female#3. Hispanic  |   .1230033   .0744384     1.65   0.099    -.0231239    .2691304
     1. Female#4. Other/Multi  |   .0486798   .0288685     1.69   0.092    -.0079909    .1053504
    Thank you

  • #2
    you can use the (undocumented) margins option citype(logit) . i use this not infrequently. unfortunately, the dislpayed CI are not stored in the results matrix for marginsplot, so graphical display of the bounded CI's is a problem. i've asked Statacorp to consider a possble modification to margins or marginsplot to enhance this frequent workflow.
    maybe there's a better offical response.
    Last edited by George Hoffman; 18 Feb 2026, 12:52.

    Comment


    • #3
      Thank you George! You predicted my next move too- marginsplot to display the results. For now, no one has called me on my current "solution" of setting the axis to 0-1 and letting the CI extend past it an unseen amount, but I would of course like a more statistically sound approach.

      Comment


      • #4
        coefplot from SSC allows -citype(logit)-. You could use it to create the marginsplot graph.

        Code:
        webuse lbw, clear
        logit low age ht ui i.smoke##i.ftv, robust
        est store low
        margins 0.smoke#ftv, vce(unconditional)
        margins 0.smoke#ftv, vce(unconditional) citype(logit)
        marginsplot, xdimension(ftv) title(Marginsplot) saving(gr1, replace)
        
        
        margins 0.smoke#ftv, vce(unconditional) post
        coefplot,  vertical recast(connected) ///
        xlab(1 "0" 2 "1" 3 "2" 4 "3" 5 "4") plotregion(margin(zero)) ///
        xtitle(`:var lab ftv') ytitle(Pr(low)) title(Coefplot) ///
        saving(gr2, replace)
        
        coefplot,  citype(logit) vertical recast(connected) ///
        xlab(1 "0" 2 "1" 3 "2" 4 "3" 5 "4")  ///
        xtitle(`:var lab ftv')  ytitle(Pr(low)) ///
        title(Coefplot with citype(logit)) saving(gr3, replace)
        
        gr combine gr1.gph gr2.gph gr3.gph, col(1)

        Res.:

        Code:
        . margins 0.smoke#ftv, vce(unconditional)
        
        Predictive margins                                         Number of obs = 187
        
        Expression: Pr(low), predict()
        
        ------------------------------------------------------------------------------
                     |            Unconditional
                     |     Margin   std. err.      z    P>|z|     [95% conf. interval]
        -------------+----------------------------------------------------------------
           smoke#ftv |
        Nonsmoker#0  |   .2867769   .0592071     4.84   0.000      .170733    .4028207
        Nonsmoker#1  |   .1842438   .0662768     2.78   0.005     .0543436     .314144
        Nonsmoker#2  |   .2775391   .0986583     2.81   0.005     .0841724    .4709058
        Nonsmoker#3  |   .3470778   .2954094     1.17   0.240    -.2319139    .9260696
        Nonsmoker#4  |   .3877901   .2741585     1.41   0.157    -.1495507    .9251309
        ------------------------------------------------------------------------------
        
        . 
        . margins 0.smoke#ftv, vce(unconditional) citype(logit)
        
        Predictive margins                                         Number of obs = 187
        
        Expression: Pr(low), predict()
        
        ------------------------------------------------------------------------------
                     |            Unconditional
                     |     Margin   std. err.      z    P>|z|     [95% conf. interval]
        -------------+----------------------------------------------------------------
           smoke#ftv |
        Nonsmoker#0  |   .2867769   .0592071     4.84   0.000     .1856629    .4149018
        Nonsmoker#1  |   .1842438   .0662768     2.78   0.005     .0868958    .3489696
        Nonsmoker#2  |   .2775391   .0986583     2.81   0.005     .1277423    .5019168
        Nonsmoker#3  |   .3470778   .2954094     1.17   0.240     .0396629    .8724783
        Nonsmoker#4  |   .3877901   .2741585     1.41   0.157     .0618054    .8589679
        ------------------------------------------------------------------------------


        Click image for larger version

Name:	Graph.png
Views:	1
Size:	30.0 KB
ID:	1784993

        Last edited by Andrew Musau; 20 Feb 2026, 10:17.

        Comment


        • #5
          In Stata 19 update on 03jun2026, we fixed support for citype() in marginsplot.
          14. marginsplot, when used after proportion, did not respect the method
          specified in proportion's option citype(), which is used to compute
          the reported confidence limits for the estimated proportions. This
          has been fixed.

          While this is not a documented feature of margins, marginsplot will
          now also respect the method specified in margins's option citype()
          when plotting the reported confidence limits.

          Comment

          Working...
          X