Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: -glm- vs -xtgee,corr(independent)-

From   Joseph Coveney <>
To   Statalist <>
Subject   Re: st: -glm- vs -xtgee,corr(independent)-
Date   Tue, 22 Aug 2006 12:33:47 +0900

Yulia Marchenko wrote:

Jeph Herrin <> asks:
> I'm trying to understand why, contrary to the documentation, these two do
> not
> give the same results:
> . glm   rate exposed, family(binomial) link(logit) robust
> . xtgee rate exposed, family(binomial) link(logit) robust /*
>                         */corr(independent) i(id)
> The -glm- converges nicely, the -xtgee- gives an error:
> estimates diverging (missing predictions)
> r(430);
> One feature is that the dependent variable is a proportion, not 0/1;

For the parameter estimates from -glm- to be equivalent to those
from -xtgee-,
the -irls- option needs to be specified with -glm-.  This is because, by
default, -glm- uses maximum likelihood optimization to obtain parameter

I would like to see Jeph's data to determine why -xtgee- did not converge.
have emailed him privately and will report any conclusions to the list.


I didn't realize that -xtgee- can accept a proportion for the response
variable with the binomial family as can -glm-.

In the dummy example below, correspondence between -xtgee- and -glm- seems
to have more to do with using -cluster()- with -glm- than with using the 

Joseph Coveney

set more off
set seed `=date("2006-08-22", "ymd")'
set obs 200
generate byte treatment = uniform() > 0.5
generate byte repetition = ceil(uniform() * 6)
generate int pid = _n
expand repetition
generate byte positive = uniform() > 0.5
xi i.repetition
xtgee positive treatment _I*, i(pid) family(binomial) ///
  link(logit) corr(independent) robust nolog
glm positive treatment _I*, family(binomial) link(logit) ///
  robust irls nolog
glm positive treatment _I*, cluster(pid) family(binomial) ///
  link(logit) nolog

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index