# Re: st: Again-Unique Case ID in Large Panel

 From rgates@stata.com (Richard Gates) To statalist@hsphsun2.harvard.edu Subject Re: st: Again-Unique Case ID in Large Panel Date Wed, 04 Aug 2004 17:42:14 -0500

```The previous version of -xtdes- could exceed the maximum number of variables
when attempting to identify the participation patterns if the time range was
large relative to the minimum time increment.

The new code will detect that the participation patterns display will exceed
the maximum display width, -width-. The current default width is 100 which on
most displays will wrap and be illegible anyway. The logic in -xtdes- will find
the time increment that will give the display a width close to -width-. I
enroneously used the logic that traps this condition to also identify that time by
id does not uniquely identify an observation.

As Nick pointed out, it is simply a bogus message (in Steve's case) and more
logic needs to be added to detect whether or not time by id uniquely identifies
an observation in this situation. Or maybe it should say, "id*Delta(time)
does not uniquely identify observations."

Steve, just for grins, you might try using -patterns(1000)- and see if any
displayed frequencies in the pattern are greater than 1. For example,

. set obs 1000
obs was 0, now 1000

. gen id = mod(_n-1,20)+1

. sort id

. by id : gen t=sum(floor(uniform()*5)+1)

. tsset id t
panel variable:  id, 1 to 20
time variable:  t, 1 to 166, but with gaps

. duplicates report id t

Duplicates in terms of id t

--------------------------------------
copies | observations       surplus
----------+---------------------------
1 |         1000             0
--------------------------------------

. xtdes, p(1000) width(50)

id:  1, 2, ..., 20                                     n =         20
t:  1, 2, ..., 166                                    T =        164
Delta(t) = 3; int((166-1)/3) + 1 = 56
(id*t does not uniquely identify observations)

Distribution of T_i:   min      5%     25%       50%       75%     95%     max
50      50      50        50        50      50      50

Freq.  Percent    Cum. |  Pattern
---------------------------+----------------------------------------------------------
1      5.00    5.00 |  .1.2.2212111.12.1111.2.1111.1.2.111.212111.11.12121.1...
1      5.00   10.00 |  .111.1112.1211.11.11211.11112212.111.21.111.11.21.1111..
1      5.00   15.00 |  .111.22.1.11.111.2121.1111211.1112.11111.1111.1.11111111
1      5.00   20.00 |  .1111112.1111.12111.212.111211111.1111111.111112.111....
1      5.00   25.00 |  .21.11112.112.2.21.32111.111.211113.111.1111.12.11......
1      5.00   30.00 |  .211.1111.1.2.11.2.111211111.11.11111.122.11.121111211..
1      5.00   35.00 |  .211211.11121111.212.11111111111.1111212.111111.11......
1      5.00   40.00 |  .31.11.11.1111.1121111112.31.21.2112.21.111211111.......
1      5.00   45.00 |  1.211111112.121221112.212111.12.11.11.1.112.2.111.......
1      5.00   50.00 |  1.22.11111.11.1111.21.2.1111212.211112.1.111.3112.1.....
1      5.00   55.00 |  11.111.2.11111121111.211112111112.11.11221.1111111......
1      5.00   60.00 |  11.211.1.21.1111221.1211111111.212.111121111.1.2.1.1....
1      5.00   65.00 |  111.21.12.1.111111.1211221.1.12.1112.1311111111111......
1      5.00   70.00 |  1111111.11.11111.2111211112.121112.11111.211111111......
1      5.00   75.00 |  111111111.1111111111111.11.112.111.1.2111.11121111111.1.
1      5.00   80.00 |  111211111.11.111113.1111112.1111.11.111.111111.2.11111..
1      5.00   85.00 |  121112.11121211.111111111.111.2.211.1112.212.11.2.......
1      5.00   90.00 |  21.1.1211111111121.21.111.311111111122.2.2.1121.........
1      5.00   95.00 |  21111111.2211.1121.22.1111222.31.2111.111.1111..........
1      5.00  100.00 |  21212111211.211.21.11.21.12111.1.21121113121............
---------------------------+----------------------------------------------------------
20    100.00         |  XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I appologize for the confusion.

-Rich
rgates@stata.com

> From statalist-owner@hsphsun2.harvard.edu Wed Aug  4 15:05:17 2004
> Received: from gateway.stata.com (gateway.stata.com [64.241.108.3])
> 	by dimebox.stata.com (8.12.8/8.12.8) with ESMTP id i74K5FuS004408;
> 	Wed, 4 Aug 2004 15:05:16 -0500
> 	by gateway.stata.com (8.11.6/8.11.6) id i74JoOi15222;
> 	Wed, 4 Aug 2004 14:50:24 -0500
> Received: from guardian.sph.harvard.edu (guardian.sph.harvard.edu [134.174.190.3])
> 	by gateway.stata.com (8.11.6/8.11.6) with ESMTP id i74JoJm15122;
> 	Wed, 4 Aug 2004 14:50:19 -0500
> Received: from hsph.harvard.edu (unverified [134.174.190.41]) by guardian.sph.harvard.edu
>  (Vircom SMTPRS 3.0.287) with ESMTP id <B0012868790@guardian.sph.harvard.edu>;
>  Wed, 4 Aug 2004 15:50:20 -0400
> Received: from hsphsun2.harvard.edu (hsphsun2 [134.174.190.44])
> 	by hsph.harvard.edu (Postfix) with ESMTP
> 	id 49F7B85E; Wed,  4 Aug 2004 15:50:20 -0400 (EDT)
> 	by hsphsun2.harvard.edu (8.11.7p1+Sun/8.11.7) with SMTP id i74JoHC04818;
> 	Wed, 4 Aug 2004 15:50:17 -0400 (EDT)
> Received: by hsphsun2.harvard.edu (bulk_mailer v1.13); Wed, 4 Aug 2004 15:50:02 -0400
> 	by hsphsun2.harvard.edu (8.11.7p1+Sun/8.11.7) id i74Jo0A04772;
> 	Wed, 4 Aug 2004 15:50:00 -0400 (EDT)
> X-Authentication-Warning: hsphsun2.harvard.edu: majordom set sender to owner-statalist@hsphsun2.harvard.edu using -f
> Received: from guardian.sph.harvard.edu (guardian.sph.harvard.edu [134.174.190.3])
> 	by hsphsun2.harvard.edu (8.11.7p1+Sun/8.11.7) with ESMTP id i74JnxM04768
> 	for <statalist@hsphsun2.harvard.edu>; Wed, 4 Aug 2004 15:49:59 -0400 (EDT)
> Received: from post1.wesleyan.edu (unverified [129.133.6.129]) by guardian.sph.harvard.edu
>  (Vircom SMTPRS 3.0.287) with ESMTP id <B0012868761@guardian.sph.harvard.edu> for <statalist@hsphsun2.harvard.edu>;
>  Wed, 4 Aug 2004 15:50:00 -0400
> Received: from [129.133.90.138] (mshanson02.econ.wesleyan.edu [129.133.90.138])
> 	(authenticated bits=0)
> 	by post1.wesleyan.edu (8.12.11/8.12.11) with ESMTP id i74JnqXF020563
> 	for <statalist@hsphsun2.harvard.edu>; Wed, 4 Aug 2004 15:49:52 -0400
> Mime-Version: 1.0 (Apple Message framework v618)
> Content-Type: text/plain; charset=US-ASCII; format=flowed
> Message-Id: <7169CB78-E64F-11D8-AFE4-000393BC24CC@wesleyan.edu>
> Content-Transfer-Encoding: 7bit
> From: "Michael S. Hanson" <mshanson@wesleyan.edu>
> Subject: Re: st: Again-Unique Case ID in Large Panel
> Date: Wed, 4 Aug 2004 15:49:48 -0400
> To: statalist@hsphsun2.harvard.edu
> X-Mailer: Apple Mail (2.618)
> X-Wesleyan-MailScanner: Found to be clean
> X-MailScanner-From: mshanson@wesleyan.edu
> Sender: owner-statalist@hsphsun2.harvard.edu
> X-Spam-Checker-Version: SpamAssassin 2.61-arrconfig27
> 	(1.212.2.1-2003-12-09-exp) on gateway.stata.com
> X-Spam-Status: No, hits=-91.0 required=6.0 tests=AWL,USER_IN_WHITELIST
> 	autolearn=no version=2.61-arrconfig27
> X-Spam-Level:
> X-scanner: scanned by Inflex 1.0.12.3 at StataCorp
>
> On Aug 4, 2004, at 2:32 PM, Nick Cox wrote:
>
> > This is a question largely for StataCorp,
>
> 	Fair enough.
>
>
> > but one mundane answer is the need to list these
> > patterns horizontally on the monitor and in log files.
>
> 	OK, I see why that might be -- but surely the preferred behavior of
> -xtdes- is not to _falsely_ claim that i*t do not identify all
> observations just because the subsequent table might be too wide!
>
>
> > Also, I doubt that anyone is going to eyeball tables
> > with several hundred columns even if their monitor or
> > printer paper is really big.
>
> 	If -xtdes- were to use 100 as the default width, and not print the
> table if width > 100, I would have no problem with that.  Even better,
> if the user specified a width(#) option with # > 100, then -xtdes-
> could interpret that as an indication that the user really does want to
> see several hundred columns.  But regardless, I respectfully suggest
> that the information passed to the user regarding the "unique
> identification" of the panel should be independent of the width option,
> and accurate for any size panel.
>
> 	I understand from the FAQ that one should be reticent from claiming
> any behavior in Stata reflects a bug -- so I shall not, but this sure
> seems to be leaning in that direction.
>
>
> > Nick
> > n.j.cox@durham.ac.uk
> >
> > Michael Hanson
> >
> >> 	Which brings me to the question: why even bother
> >> setting a default width, let alone setting it so low?
>
> *
> *   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/
*
*   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/
```