Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: panel data regression - number of observations

From   Nick Cox <>
To   "''" <>
Subject   st: RE: panel data regression - number of observations
Date   Fri, 22 Jun 2012 13:00:06 +0100

I'll pass on #2. 

The answer to #1 is No. This is easy enough to check. For example, from this code 

webuse grunfeld
xtreg invest year
drop if year < 1940 & company == 1
xtreg invest year

you will see that -xtreg- uses what it can, including incomplete panels. 

Indeed incompleteness is, roughly speaking, like beauty, in the mind of the beholder, and not something Stata generally knows or cares about. 

You can certainly insist on using what you regard as complete panels. Your syntax will work if and only if a variable called -time- has the value 124 for only those observations you want to include. You can do something like this 

xtreg y x1 x2 x3

egen count = total(e(sample)), by(company) 

xtreg y x1 x2 x3 if count == 120 

or 124 if you prefer. 


Braunfels, Philipp 

I have a large panel dataset, covering 10 years of monthly data. One of my variables is stock return for which I have approximately 3000 companies. However, the return observations are not complete for all 3000 companies (some just have 2 or 5 years of data e.g.). In this respect I would have two questions:

1) if I run a panel-regression, does stata automatically exclude all companies for which the return data are not complete? (e.g. I regress years 1990-2000 and for 500 companies the data from 1990-1993 are missing. Are these companies completely excluded from the analysis?) If stata does not exclude observations (companies) with an insufficient number of values (returns over time) how can I account for this (maybe using sth. <xtreg y x1 x2 x3 if time==124, fe> - where 124 are monthly observations for the 10 years I cover?

2) The hausman test predicts that I should use FE. The output gives me three values for R-square (between, within, overall). But when I use the command <estimates table output, stats(r2)> I am given a different R-square than those reported in the <xtreg,fe> output. So where does the <estimates table output, stats(r2)> come from (I also run an <areg> regression and this R-square differs as well!)

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index