The output does not match the SAS output exactly due to different estimation
techniques but the results are very similar. If odds ratios are desired rather than the
regression coefficients, then theeformoption can be used to exponentiate the
regression parameter estimates. The code and output using theeformoption follow:
xtgee outcome birthwgt gender diarrhea, family (binomial)
link (logit) corr (ar1) robust eform
GEE population-averaged model Number of obs ¼ 1203
Group and time vars: idno month Number of groups ¼ 136
Link: logit Obs per group: min ¼ 5
Family: binomial avg ¼ 8.8
Correlation: AR(1) max ¼ 9
Wald chi2(3) ¼ 2.73
Scale parameter: 1 Prob>chi2 ¼ 0.4353
(standard errors adjusted for clustering on idno)
outcome Odds Ratio
Semi-robust
Std. Err. z P>jzj [95% Conf. Interval]
birthwgt .9995059 .0003085 1.60 0.109 .9989015 1.000111
gender 1.002383 .5579818 0.00 0.997 .3366729 2.984417
diarrhea 1.248122 1.071885 0.26 0.796 .2318711 6.718423
Thextcorrcommand can be used after running the GEE model to output the
working correlation matrix. The code and output follow:
xtcorr
Estimated within-idno correlation matrix R:
c1 c2 c3 c4 c5 c6 c7 c8 c9
r1 1.0000
r2 0.5252 1.0000
r3 0.2758 0.5252 1.0000
r4 0.1448 0.2758 0.5252 1.0000
r5 0.0761 0.1448 0.2758 0.5252 1.0000
r6 0.0399 0.0761 0.1448 0.2758 0.5252 1.0000
r7 0.0210 0.0399 0.0761 0.1448 0.2758 0.5252 1.0000
r8 0.0110 0.0210 0.0399 0.0761 0.1448 0.2758 0.5252 1.0000
r9 0.0058 0.0110 0.0210 0.0399 0.0761 0.1448 0.2758 0.5252 1.0000
The same results could have been obtained with thextlogitcommand. Thextlogit
command is designed specifically for logistic regression with clustered data. The
following code runs the same GEE model as shown above with thextlogitcommand:
xtlogit outcome birthwgt gender diarrhea, pa corr(ar1) vce(robust) or
660 Appendix: Computer Programs for Logistic Regression