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

st: xtreg reports a range of obs per group that I don't understand


From   "M. Douglas Berg" <eco_mdb@shsu.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: xtreg reports a range of obs per group that I don't understand
Date   Wed, 29 Sep 2004 09:39:37 -0500

Hello,

I am using xtreg to estimate the relationship between market price "p" and a computed intrinsic value "iv". The data is organized by company identifier "permno" and year "yr". The variable "piv" is the ratio of "p" divided by "iv". I create a variable called group_size to represent the number of observations per permno. I then drop observations where group_size is less than 4. In other words I want each company in my dataset to have at least 4 years worth of data. When I do
xtreg p iv if piv>=1 & piv<50, re
the output reports that the minimum number of observations per group is 1. I was expecting that this number should be 4 or greater. Could someone please explain?
I include part of the log file below.

Thanks for any help you may provide.

Doug Berg

-------------------------------------------------------------------------------------------------
use astockdata.dta, clear

.
. tsset permno yr
panel variable: permno, 10001 to 93113
time variable: yr, 1968 to 2002, but with gaps
. /* Create a group size variable. Drop permno groups where there are fewer than 4 observat
> ions. */
. gen group_size=0

.
. by permno: replace group_size=_N
(51463 real changes made)

.
. drop if group_size < 4
(4347 observations deleted)

. /* Performing the Hausman test */
.
. xtreg p iv if piv>=1 & piv<50, re

Random-effects GLS regression Number of obs = 34147
Group variable (i): permno Number of groups = 4074

R-sq: within = 0.1542 Obs per group: min = 1
between = 0.4861 avg = 8.4
overall = 0.3070 max = 30

Random effects u_i ~ Gaussian Wald chi2(1) = 8031.61
corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000

------------------------------------------------------------------------------
p | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
iv | .8689448 .009696 89.62 0.000 .849941 .8879485
_cons | 17.02923 .2104142 80.93 0.000 16.61682 17.44163
-------------+----------------------------------------------------------------
sigma_u | 10.679944
sigma_e | 14.693601
rho | .34567866 (fraction of variance due to u_i)
------------------------------------------------------------------------------

. estimates store random_effects

. xtreg p iv if piv>=1 & piv<50, fe

Fixed-effects (within) regression Number of obs = 34147
Group variable (i): permno Number of groups = 4074

R-sq: within = 0.1542 Obs per group: min = 1
between = 0.4861 avg = 8.4
overall = 0.3070 max = 30

F(1,30072) = 5480.55
corr(u_i, Xb) = 0.3626 Prob > F = 0.0000

------------------------------------------------------------------------------
p | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
iv | .7437109 .010046 74.03 0.000 .7240203 .7634014
_cons | 20.6917 .1151006 179.77 0.000 20.4661 20.91731
-------------+----------------------------------------------------------------
sigma_u | 14.504545
sigma_e | 14.693601
rho | .49352532 (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(4073, 30072) = 8.11 Prob > F = 0.0000

. hausman . random_effects

---- Coefficients ----
| (b) (B) (b-B) sqrt(diag(V_b-V_B))
| . random_eff~s Difference S.E.
-------------+----------------------------------------------------------------
iv | .7437109 .8689448 -.1252339 .0026287
------------------------------------------------------------------------------
b = consistent under Ho and Ha; obtained from xtreg
B = inconsistent under Ha, efficient under Ho; obtained from xtreg

Test: Ho: difference in coefficients not systematic

chi2(1) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= 2269.71
Prob>chi2 = 0.0000




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