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: xtdescribe and panel data


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: xtdescribe and panel data
Date   Tue, 6 Sep 2011 10:31:39 +0100

On Tue, Sep 6, 2011 at 9:12 AM, A. Berâ <[email protected]> wrote:

>    I have some panel data as described below. Few questions:
>
> 1. Can these data be analyzed by panel data methods? I would
> appreciate any suggestions about a suitable approach for these data.

You have panel data. You let slip that the panels are firms. Do
something that makes economic sense.
That seems all that can be advised.

> 2. How can I delete firms that have a specific pattern? For example
> how can I delete these type of firms: 1..........111 ?

You can create a pattern variable like this.

use  http://www.stata-press.com/data/r10/xtdatasmpl.dta, clear
xtset idcode year
keep if idcode <= 5
su year, meanonly
local max = r(max)
local min = r(min)
local range = r(max) - r(min) + 1
local miss : di _dup(`range') "."
bysort idcode (year) : gen this = substr("`miss'", 1, year[1]-`min') +
"1" if _n == 1
by idcode : replace this = substr("`miss'", 1, year- year[_n-1] - 1) +
"1" if _n > 1
by idcode : replace this = this + substr("`miss'", 1, `max'-year[_N])
if _n == _N
by idcode : gen pattern = this[1]
by idcode : replace pattern = pattern[_n-1] + this if _n > 1
by idcode : replace pattern = pattern[_N]
tab pattern
xtdes

After that you can do things conditionally on values of -pattern-.

> 3. Is imputation appropriate if "holes" between years is more than one?

You could interpolate. People usually don't with this kind of data.

> Many thanks for any help.
> --
> abdullah berâ
>
>
> . xtdescribe, patterns(1000)
>
>    id:  2, 3, ..., 37376                                  n =      22997
>     date:  1996, 1997, ..., 2009                             T =         14
>           Delta(date) = 1 unit
>           Span(date)  = 14 periods
>           (id*date uniquely identifies each observation)
>
> Distribution of T_i:   min      5%     25%       50%       75%     95%     max
>                         1       1       2         4         9      14      14
>
>     Freq.  Percent    Cum. |  Pattern
>  ---------------------------+----------------
>     3171     13.79   13.79 |  1.............
>     2447     10.64   24.43 |  11111111111111
>     1932      8.40   32.83 |  11............
>     1471      6.40   39.23 |  ...........111
>     1066      4.64   43.86 |  ..........1111

<big snip>

*
*   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