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

From |
"Michael Blasnik" <michael.blasnik@verizon.net> |

To |
<statalist@hsphsun2.harvard.edu> |

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

Date |
Wed, 29 Sep 2004 10:53:00 -0400 |

You include an -if- statement in you xtreg command, but not in your counting command, so groupsize may be >=4, but there may not be 4 observations that meet the piv criteria. You may want to change you group size calc to: egen group_size=sum(piv>=1 & piv<50), by(permno) Michael Blasnik michael.blasnik@verizon.net ----- Original Message ----- From: "M. Douglas Berg" <eco_mdb@shsu.edu> To: <statalist@hsphsun2.harvard.edu> Sent: Wednesday, September 29, 2004 10:39 AM Subject: st: xtreg reports a range of obs per group that I don't understand > 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) > -------------------------------------------------------------------------- ---- > <snip> * * 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/

**References**:**st: xtreg reports a range of obs per group that I don't understand***From:*"M. Douglas Berg" <eco_mdb@shsu.edu>

- Prev by Date:
**st: Panel data + stochastic frontier (xtfrontier)** - Next by Date:
**Re: st: further version questions** - Previous by thread:
**st: xtreg reports a range of obs per group that I don't understand** - Next by thread:
**st: Using weights and robust with ivprob (Amemiya's gls)** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |