Announcement

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

  • Trouble with coefplot and odds ratios

    Hello,

    I'm having an unusual problem I can't seem to resolve. I'm running three logits and want to present several results as odds ratios rather than coefficients (it's going to a clinical journal). For tables, not problem - esttab works just fine with the `eform' option. But, I also want to graph it using `coefplot' and I'm getting an unusual thing: my odds ratio point estimates are not centered in my 95% confidence intervals for the graph, though they obviously are when calculating the upper and lower bounds of the CI. Does anyone have a suggestion as to why this is happening?

    Thanks!
    David Bradford



    My code is:

    local v="opioid";
    logit any_exclusion l.any_`v'_dol l2.any_`v'_dol l3.any_`v'_dol $xvars st_*, vce(cluster fips);
    estimates store `v'_any_dola;

    logit any_exclusion l.any_`v'_dol l2.any_`v'_dol l3.any_`v'_dol $xvars st_* if metro==1, vce(cluster fips);
    estimates store `v'_any_dolm;

    logit any_exclusion l.any_`v'_dol l2.any_`v'_dol l3.any_`v'_dol $xvars st_* if urban==1, vce(cluster fips);
    estimates store `v'_any_dolu;

    estimates restore opioid_any_dolm;
    estimates store Metro;
    estimates restore opioid_any_dolu;
    estimates store Urban;
    estimates restore opioid_any_dola;
    estimates store All;
    coefplot (All, mcolor(black) ciopts(lcolor(black) recast(rcap)) ) ||
    (Metro, mcolor(black) ciopts(lcolor(black) recast(rcap)) ) ||
    (Urban, mcolor(black) ciopts(lcolor(black) recast(rcap)) )
    ,
    keep(L.any_opioid_dol L2.any_opioid_dol L3.any_opioid_dol)
    xline(1) levels(95) byopts(row(1)) eform citype(logit) mlabel
    ylabel( 1 "Any opioid dollars, lagged one quarter"
    2 "Any opioid dollars, lagged two quarters"
    3 "Any opioid dollars, lagged three quarters"
    , labsize(small))
    /*ytitle("Odds Ratio for Any Exclusion", size(small))*/
    xtitle("Figure 1: Key odds ratios from logit models predicting any physician HHS exclusion in county and quarter", size(small))
    saving("$results/OR for any opioid dollars logits.gph", replace)
    ;

    And the resulting coefplot is:

  • #2
    my odds ratio point estimates are not centered in my 95% confidence intervals for the graph, though they obviously are when calculating the upper and lower bounds of the CI
    Not obvious in what you show us. You are using the logit command, so you are seeing coefficient estimates that are centered in their confidence interval. But the confidence interval for the exponentiated coefficient (the odds ratio) is the exponentiated value of the confidence interval for the coefficient - and since exponentiation is not a linear function, the symmetry of the confidence interval about the point estimate will not be preserved.

    Consider the examples below. Note that the point estimates and confidence intervals in the output of logistic are each the exponentiated values of the point estimates and confidence intervals in the output of logit. Note that the confidence intervals in the output of logistic are not symmetrical about the point estimates.
    Code:
    . sysuse auto, clear
    (1978 Automobile Data)
    
    . logistic foreign mpg weight
    
    Logistic regression                             Number of obs     =         74
                                                    LR chi2(2)        =      35.72
                                                    Prob > chi2       =     0.0000
    Log likelihood = -27.175156                     Pseudo R2         =     0.3966
    
    ------------------------------------------------------------------------------
         foreign | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |   .8448578   .0776572    -1.83   0.067     .7055753    1.011635
          weight |   .9961009   .0010077    -3.86   0.000     .9941279    .9980779
           _cons |   898396.7    4059594     3.03   0.002     127.9781    6.31e+09
    ------------------------------------------------------------------------------
    Note: _cons estimates baseline odds.
    
    . logit
    
    Logistic regression                             Number of obs     =         74
                                                    LR chi2(2)        =      35.72
                                                    Prob > chi2       =     0.0000
    Log likelihood = -27.175156                     Pseudo R2         =     0.3966
    
    ------------------------------------------------------------------------------
         foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
             mpg |  -.1685869   .0919175    -1.83   0.067    -.3487418     .011568
          weight |  -.0039067   .0010116    -3.86   0.000    -.0058894    -.001924
           _cons |   13.70837   4.518709     3.03   0.002     4.851859    22.56487
    ------------------------------------------------------------------------------

    Comment


    • #3
      Ah, I see that, yes. Maybe I'll explore using r(table) to pull the OR and upper and lower bounds for the 95% CI and just make my own twoway plot of it then. Thanks!

      Comment

      Working...
      X