Statalist The Stata Listserver


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

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


From   Jeph Herrin <junk@spandrel.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: -glm- vs -xtgee,corr(independent)-
Date   Tue, 22 Aug 2006 08:55:13 -0400

I agree with Joseph Coveney, in that for the -glm- and -xtgee-
results to match, I had to specify -cluster()- for -glm-; the
-irls- option didn't seem to matter.

thanks,

Jeph


Joseph Coveney wrote:
Yulia Marchenko wrote:

Jeph Herrin <junk@spandrel.net> 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
estimates.

I would like to see Jeph's data to determine why -xtgee- did not converge.
I
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 IRLS
algorithm.

Joseph Coveney

clear
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
exit


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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