Logistic Regression: A Self-learning Text, Third Edition (Statistics in the Health Sciences)

(vip2019) #1

The next model includes a random slope for the variable DIARRHEA in addition to
the random intercept. The model is stated as follows:


logit PðOUTCOME¼ 1 jXÞ¼ðb 0 þb 0 iÞþb 1 BIRTHWGTþb 2 GENDER
þðb 3 þb 3 iÞDIARRHEA;
whereb 0 irepresents the random intercept for subjectiand where
b 3 irepresents a random slope with the variable DIARRHEA for
subjectib 0 iNð 0 ;ss^2 Þandb 3 iNð 0 ;s^20 Þ

This type of model cannot be run with thextlogitcommand but can with thextme-
logitcommand. The code for running this model with two random effects follows:


xtmelogit outcome birthwgt gender diarrhea || idno: diarrhea,
intpoints (3) covariance (uns) or

The code is similar to what was shown with the previous random intercept model
except that DIARRHEA is added as a random effect (after idno:) as well as a fixed
effect. Since this model contains more than one random effect we must consider the
covariance between the random effects. Thecovariance(uns)requests an unstruc-
tured covariance structure for the random effects. The defaultindependentcovari-
ance structure or theexchangeablecovariance structure could also be requested for
the random effects. The output follows:


Mixed–effects logistic regression Number of obs ¼ 1203
Group variable: idno Number of groups ¼ 136
Obs per group: min ¼ 5
avg ¼ 8.8
max ¼ 9
Integration points¼3 Wald chi2 (3) ¼ 2.10
Log likelihood¼167.91199 Prob>chi2 ¼ 0.5511


outcome Odds Ratio Std. Err. z P>jzj [95% Conf. Interval]


birthwgt .9993232 .0006149 1.10 0.271 .9981188 1.000529
gender 1.829316 1.610209 0.69 0.493 .3258667 10.26922
diarrhea 9.50e06 .0001605 0.68 0.494 3.92e20 2.30eþ 09




Random–effects Parameters Estimate Std. Err. [95% Conf. Interval]


idno: Unstructured
sd (diarrhea) 10.5301 12.99674 .9372181 118.3109
sd(_cons) 2.779649 .5656848 1.865359 4.142071
corr(diarrhea, _cons) .611977 .1909544 .11323 .8643853


LR test vs. logistic regression: chi2(3)¼154.23 Prob>chi2¼0.0000


Note: LR test is conservative and provided only for reference.






664 Appendix: Computer Programs for Logistic Regression

Free download pdf