Bookmark and Share

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: Unbalanced to Balanced panel


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   RE: st: Unbalanced to Balanced panel
Date   Tue, 8 Nov 2011 17:01:37 +0000

Suppose K = 8. Then this command drops all panels that have 9 or more observations. Is that what is wanted? (Of course changing = to >= doesn't by itself solve the problem because then the panels would be unbalanced.)

(A secondary detail is that Muhammad's code does not depend on a prior -xtset-.) 

In many situations, researchers might well want to keep some years in a panel that is longer than the minimum acceptable length. 

The problem with the question is that only one unambiguous criterion is explicit -- that panels be balanced -- and little else is said. Maximising N * T is not a criterion easy to work with if N = 500, T = 1 and also N = 5, T = 100, not far from the truth in some fields. 

For example, 

1. Is it important that panels be for exactly the same years? This is a question only researchers can answer. Sometimes it is crucial; at other times completely unimportant. 

2. What about the trade off between number of panels and length of panels? Again the researcher must decide. 

If anyone offers a quick fix solution for this, it is likely to be of dubious merit unless it lets you consider these considerations, and others -- for example, balanced panels are not much good if depleted by missing values. 

-xtbalance- (SSC) is quoted, but not properly cited, by the original poster. Its approach is to specify the same time interval for all panels, but then optionally to drop any missing values! Optional or not, in what sense does balance help if there are missing values? 

Careful study of -xtdescribe- results seems vital to any good decision on this. -xtpatternvar- (SSC) is a helper program. 

Nick 
[email protected] 

Muhammad Anees

after you do your data xtset id year;

bys pid: gen nyear=[_N]
keep if nyear==K

where k is the number of years you want to keep data for and where
every individual is traced.

On Tue, Nov 8, 2011 at 11:08 AM, Vinod Mishra <[email protected]> wrote:

> I have an unbalanced panel data and I want to make it balanced, such that I am left with the biggest possible 'N X T' balanced panel. Is there a stata program that automatically does that ?
>
> I am aware of stfill and xtbalance. But I don't think they do, what I want to do.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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