What is noteworthy with this output is that there are no parameter estimates for the
variables BIRTHWGT and GENDER because the values of these variables do not vary
within a cluster (infant). This is a key feature of conditional logistic regression. An
intercept is not estimated for the same reason. As noted at the top of the output, even
the variable of interest DIARRHEA, did not vary within most (115) of the infants. The
data from only 21 infants were used for this analysis.
A model with a random effect for each infant can be run two ways in Stata: one way is
with thextlogitcommand and thereoption and the other way with thextmelogit
command. A model with a random effect (a random intercept) for infant is stated as
follows:
logit PðOUTCOME¼ 1 jXÞ¼ðb 0 þb 0 iÞþb 1 BIRTHWGTþb 2 GENDER
þb 3 DIARRHEA;
whereb 0 irepresents the random effect for subjectiand is normally
distributed with mean¼ 0 and variance¼ss^2 ði:e:; b 0 iNð 0 ;ss^2 Þ
The code and output for the model using thextlogitcommand with thereoption (the
default option) follow:
xtlogit outcome birthwgt gender diarrhea, re or
Theoroption requests the parameter estimates be exponentiated. The output
follows:
Random–effects logistic regression Number of obs ¼ 1203
Group variable: idno Number of groups ¼ 136
Random effects u_iGaussian Obs per group: min ¼ 5
avg ¼ 8.8
max ¼ 9
Wald chi2(3) ¼ 3.69
Log likelihood¼164.50654 Prob>chi2 ¼ 0.2973
outcome OR Std. Err. z P>jzj [95% Conf. Interval]
birthwgt .999352 .0005498 1.18 0.239 .998275 1.00043
gender 1.59722 1.26687 0.59 0.555 .3374548 7.559861
diarrhea 2.638831 1.753562 1.46 0.144 .717413 9.706306
/lnsig2u 2.360601 .276463 1.818743 2.902458
sigma_u 3.255352 .4499922 2.482762 4.268358
rho .7631004 .0499785 .6520122 .8470451
Likelihood–ratio test of rho¼0: chibar2(01)¼161.04 Prob>¼ chibar2¼
0.000
The estimated odds ratio for DIARRHEA is 2.64, but it is not statistically significant
as the standard error is large at 1.75 (p-value¼0.144). The standard deviation of the
662 Appendix: Computer Programs for Logistic Regression