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