Statalist The Stata Listserver


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

st: Inconsistent number and maximum size of groups using -xtlogit, fe-


From   "David W. Harless" <[email protected]>
To   [email protected]
Subject   st: Inconsistent number and maximum size of groups using -xtlogit, fe-
Date   Wed, 11 Apr 2007 11:42:32 -0400

I am estimating a model using conditional logit/fixed-effects logit, but using the command -xtlogit, fe- because it reports (and saves in e()) information on the number and size of groups. But in a sample with some very large group sizes, the number of groups and the maximum size of group from -xtlogit, fe- is different than what I calculate directly. For example:

********************************************************************************
. xtlogit adverse x , fe i(g1)
note: multiple positive outcomes within groups encountered.
note: 19918 groups (525174 obs) dropped due to all positive or
all negative outcomes.

Iteration 0: log likelihood = -11648.872
Iteration 1: log likelihood = -11647.283
Iteration 2: log likelihood = -11647.282
Iteration 3: log likelihood = -11647.282

Conditional fixed-effects logistic regression Number of obs = 1522444
Group variable (i): g1 Number of groups = 597

Obs per group: min = 2
avg = 2121.8
max = 31712

LR chi2(1) = 3.76
Log likelihood = -11647.282 Prob > chi2 = 0.0524

------------------------------------------------------------------------------
adverse | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | -.1458831 .0743596 -1.96 0.050 -.2916254 -.0001409
------------------------------------------------------------------------------

. keep if e(sample)
(525174 observations deleted)

. collapse (count) adverse, by(g1)

. summ adverse, d

(count) adverse
-------------------------------------------------------------
Percentiles Smallest
1% 2 2
5% 11 2
10% 36 2 Obs 603
25% 145 2 Sum of Wgt. 603

50% 505 Mean 2524.783
Largest Std. Dev. 6166.928
75% 1734 36928
90% 5423 47192 Variance 3.80e+07
95% 14684 48473 Skewness 4.51094
99% 31712 51907 Kurtosis 26.67479

. disp r(sum)
1522444

. count if adverse<=31712
597
*******************************************************************************

Hence, when I use -collapse- to calculate the number and sizes of groups, I obtain 603 groups (compared to 597 in -xtlogit, fe-) and find six groups having more members than the maximum group size reported by -xtlogit, fe- (31,712).


I note that if I go back to my original data set and use only the groups with more than 31712 observations, the number of groups is indicated as 0 and there are missing values for the number of observations per group:

**********************************************************************************
. quietly bysort g1: gen grp_cnt = _N

. xtlogit adverse x if grp_cnt>31712, fe i(g1)
note: multiple positive outcomes within groups encountered.

Iteration 0: log likelihood = -1205.835
Iteration 1: log likelihood = -1205.8343
Iteration 2: log likelihood = -1205.8343

Conditional fixed-effects logistic regression Number of obs = 255748
Group variable (i): g1 Number of groups = 0

Obs per group: min = .
avg = .
max = .

LR chi2(1) = 1.31
Log likelihood = -1205.8343 Prob > chi2 = 0.2533

------------------------------------------------------------------------------
adverse | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
x | .3934376 .3650677 1.08 0.281 -.3220821 1.108957
------------------------------------------------------------------------------

**********************************************************************************

I am using an updated Stata/MP for 64-bit Windows:
. about

Stata/MP 9.2 for Windows 64-bit x86-64
Born 06 Feb 2007

Dave Harless





*
* 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