Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: xtivreg2 singleton groups identification or definitions
From
"Shao,Diana" <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: xtivreg2 singleton groups identification or definitions
Date
Wed, 26 Mar 2014 20:09:57 +0000
Hello Nick,
Thanks a lot. It did solve the problem.
Diana
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Nick Cox
Sent: Wednesday, March 26, 2014 4:00 PM
To: [email protected]
Subject: Re: st: xtivreg2 singleton groups identification or definitions
Guessing a bit: your code
by firm: gen number=_N
count if number==1
will miss groups with more than one observation but only one observation that is non-missing on the variables you are using. In the simplest kind of case
id foo
42 2,71828
42 .
panel 42 has two observations but only one non-missing value.
Perhaps the easiest way to approach this to run -xtivreg2- and then
edit if !e(sample) & number > 1
to see the offlap.
Nick
[email protected]
On 26 March 2014 19:39, Shao,Diana <[email protected]> wrote:
> Hello all,
> I'm using the -xtivreg2- to run a regression that considers firm fixed effect and two-way cluster (firm year). So -xtivreg- seems to be a good choice. I have read through several posts on statalist that the singletons groups would be detected and not used in running xtivreg2. One of the posts says "a singleton is a group in which there is only one observation". I use "xtset gvkey" on my data so I assume that a singleton group for my sample would be a firm that only enters the sample once. When running xtivreg2, stata says that 1592 singleton groups detected. But when I manually sort firm and then by firm: gen number=_N and count if number==1, stata reports 1406. I wonder if anyone knows how to explain this discrepancy between the counting of singleton groups. Did I understand the definition of singleton groups wrong? Or did I count in a wrong way?
> Or if anyone knows how to control for firm fixed effect and at the same time clustering both year and firm, that'd be greatly appreciated too.
> Many thanks to all of you.
> Anxiously waiting for replies,
> Diana Shao
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/