Fitting mixed-effects logistic regression models

webuse bangladesh, clear 

Null fixed-effects model

melogit c_use
------------------------------------------------------------------------------
       c_use |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       _cons |  -.4370216   .0465681    -9.38   0.000    -.5282934   -.3457499
------------------------------------------------------------------------------
  • model: logit(c_use)= ß0 + ε where:
  • logit(c_use)= log(odds of c_use)= log(prob of c_use/(1- prob of c_use))
  • ß0 =_const= -.4370216 = exp(-.4370216)/(1+exp(-.4370216))= .39245089 = the prob of c_use in this population to confirm: ``` . tab c_use

    Use |
    

    contracepti | on | Freq. Percent Cum. ————+———————————– no | 1,175 60.75 60.75 yes | 759 39.25 100.00 ————+———————————– Total | 1,934 100.00


## Fixed-effects model with one single binary predictor

melogit c_use urban

   c_use |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]

————-+—————————————————————- urban | .7191986 .1018055 7.06 0.000 .5196635 .9187338

_cons | -.6551198 .0569176 -11.51 0.000 -.7666763 -.5435633


- model: logit(c_use)= ß0 + ß1(urban) + ε
where:
- ß0 = exp(-.6551198)/(1+exp(-.6551198))= .34183673 = the prob of c_use when urban==0

to confirm:

. tab c_use if urban==0

        Use |
contracepti |
         on |      Freq.     Percent        Cum.
------------+-----------------------------------
         no |        903       65.82       65.82
        yes |        469       34.18      100.00
------------+-----------------------------------
      Total |      1,372      100.00

  • ß1 = the log of the ratio of the odds of c_use when urban==1 to the odds of c_use when urban==0.
  • so exp(ß1) is the odds ratio= 2.0527874 (urban women have twice the odds of using contraceptives)

melogit c_use age urban, or

   c_use | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]

————-+—————————————————————- age | 1.007428 .0052726 1.41 0.157 .9971463 1.017815 urban | 2.059527 .2098625 7.09 0.000 1.686675 2.5148

_cons | .5186244 .0295449 -11.53 0.000 .4638332 .579888

```

01/01/0001