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

st: Wrong no. of obs. in xtreg fixed effect option


From   "Ali Karim" <[email protected]>
To   [email protected]
Subject   st: Wrong no. of obs. in xtreg fixed effect option
Date   Wed, 17 Jul 2002 18:55:56 +0000

Dear readers,

I have not been able to figure out why stata gives the wrong number of observation with xtreg fixed effect option. For example: I am predicting change of knowledge over two periods in time and its associated with change of exposure. I get the following output:


. xtreg hiv_tot_cor year core_ad,i(newcs) fe

Fixed-effects (within) regression Number of obs = 7237
Group variable (i) : newcs Number of groups = 5015

R-sq: within = 0.0332 Obs per group: min = 1
between = 0.0017 avg = 1.4
overall = 0.0081 max = 2

F(2,2220) = 38.16
corr(u_i, Xb) = -0.0424 Prob > F = 0.0000

------------------------------------------------------------------------
hiv_tot_cor | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------+----------------------------------------------------------------
year | .1355214 .0191276 7.09 0.000 .0980115 .1730313
core_ad | .1429555 .0335556 4.26 0.000 .077152 .2087591
_cons | 1.763668 .0149903 117.65 0.000 1.734272 1.793065
-------+----------------------------------------------------------------
sigma_u | .68639679
sigma_e | .63330582
rho | .54016449 (fraction of variance due to u_i)
------------------------------------------------------------------------
F test that all u_i=0: F(5014, 2220) = 1.54 Prob > F = 0.0000

The number of observations that went into the fixed effect analysis is not the number mentioned in the above output. Therefore, I select the sample with observations for both the periods, then I get:-

. xtreg hiv_tot_cor year core_ad if interview==2,i(newcs) fe

Fixed-effects (within) regression Number of obs = 4444
Group variable (i) : newcs Number of groups = 2222

R-sq: within = 0.0332 Obs per group: min = 2
between = 0.0080 avg = 2.0
overall = 0.0175 max = 2

F(2,2220) = 38.16
corr(u_i, Xb) = 0.0057 Prob > F = 0.0000

------------------------------------------------------------------------
hiv_tot_cor | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year | .1355214 .0191276 7.09 0.000 .0980115 .1730313
core_ad | .1429555 .0335556 4.26 0.000 .077152 .2087591
_cons | 1.793538 .0150765 118.96 0.000 1.763972 1.823103
-------------+----------------------------------------------------------
sigma_u | .5792349
sigma_e | .63330582
rho | .45549543 (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(2221, 2220) = 1.67 Prob > F = 0.0000

Now I have different number of obs (the correct one), rho, sigma_u, and sigma_e estimates. Thankfully the parameter estimates of my covariates are the same.

Any comments?

Ali Mehryar Karim
Doctoral student
Tulane University
1440 Canal St, Suite 2200
Ph # (504) 988-1348
Fax (504) 584-3653
email: [email protected]


_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail. http://www.hotmail.com


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