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: xtreg, fe - xtivreg2, fe and panel units non nested within clusters

From   "Schaffer, Mark E" <[email protected]>
To   <[email protected]>
Subject   st: RE: xtreg, fe - xtivreg2, fe and panel units non nested within clusters
Date   Wed, 10 Aug 2011 21:11:49 +0100


The issue has to do with what dof adjustment to use when panels are not
nested within clusters.  Here is a Statalist posting which you might
find helpful:


> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Agnese Romiti
> Sent: 10 August 2011 12:05
> To: [email protected]
> Subject: st: xtreg, fe - xtivreg2, fe and panel units non 
> nested within clusters
> Dear statalisters,
> I need to run xtreg, fe and xtivreg2, fe with a cluster 
> variable which changes within the panel identifier.
> I get two errors messages:  when I run xtreg , fe I get the 
> following error message
> ''panels are not nested within clusters''
> Whereas when I run xtivreg2, fe  the error message is the following
> ''cluster option not supported if a panel spans more than one 
> cluster''
> I tried to perfom manually the within tranformation and then 
> I run the commands reg and ivreg on the pooled tranformed 
> sample. In such a  way the program allows me to use the 
> cluster robust SE even though the panel variable is not 
> nested in the same cluster.
> Is this procedure correct or is there any better alternative 
> to fix this problem due to the cluster option?
> Before following this route I checked whether my pooled OLS 
> regression on the transformed data ( without using any 
> cluster option) provides identical results to the case of 
> running xtreg, fe. But unfortunately this is not the case: 
> the results I obtained by the manual transformations are not 
> identical to the ones obtained by using xtreg, fe as I would 
> have expected.
> This is the code I've used in order to trasform the data
> foreach num of varlist var1 var2 {
> bys id: egen mean_`num'=mean(`num')
> gen `num'_t=`num'-mean_`num'
> drop mean_`num'
> }
> I was wondering whether this problem has to do with the way 
> xtreg, fe is implemented in Stata.
> Many thanks
> Agnese
> *
> *   For searches and help try:
> *
> *
> *

Heriot-Watt University is a Scottish charity
registered under charity number SC000278.

*   For searches and help try:

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