Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: gllamm vs xtlogit: repeated obs & dummy variables


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: gllamm vs xtlogit: repeated obs & dummy variables
Date   Tue, 11 Feb 2003 12:42:36 +0900

Rudy Espino received a conformability error with -gllamm- in a random-effects logistic 
regression that seemed to work with -xtlogit-.  It seems that he suspects that -gllamm- 
handles collinear predictor (independent) variables differently from the way that -xtlogit- 
does.  

------------------------begin excerpt of posting--------------------------------

I have panel-data (2 level model) with binary outcomes.  In using 'xtlogit', I can include 
an entire set of mutually exclusive dummies (e.g., if there are three dummies for race, 
you can include all three).  In the equivalent 'gllamm' model, I receive a conformability 
error.  In most other Stata commands (e.g., regress) Stata catches your error and will 
automatically drop one of the variables for you.

I was curious as to why 'xt' would allow the entire set of categorical indicators and why 
'gllamm' does not. 

--------------------------end excerpt of posting--------------------------------

I'm sure that there are a number of conditions that give rise to unconformable matrixes 
in -gllamm-'s execution and, for all I know, certain circumstances of nearly collinear 
variables might be among them.  But an attempt (see illustration.do below) to produce a 
conformability error with deliberate collinear and near-collinear variables doesn't.  
Instead, with a collinear variable, -gllamm- traps the error with the following error 
message:

    variables have been dropped, can't continue
    r(198);

If you need to trap collinear variables prior to using -gllamm-, you can use -_rmcoll- as 
illustrated below.

Joseph Coveney

------------------------begin illustration.do---------------------------------

set more off
sysuse nlsw88, clear
xi: xtlogit never_married i.race, i(industry) nolog
xi: gllamm never_married i.race, i(industry) family(binomial) ///
   link(logit) nolog
*
* Creating collinear variable
*
generate byte bla=race==2
xi: xtlogit never_married i.race bla, i(industry) nolog
capture noisily xi: gllamm never_married i.race bla, i(industry) ///
   family(binomial) link(logit) nolog
display _rc
_rmcoll _I* bla
gllamm never_married `r(varlist)', i(industry) family(binomial) ///
   link(logit) nolog
*
* Modifying collinear to near-collinear
*
set seed 20030211
replace bla=bla==0 if uniform()>0.999
xi: xtlogit never_married i.race bla, i(industry) nolog
xi: gllamm never_married i.race bla, i(industry) ///
   family(binomial) link(logit) nolog
exit

--------------------------end illustration.do---------------------------------

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index