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: Re: st: exit variable in opreg by Yasar, Raciborski, Poi (2008)


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: Re: st: exit variable in opreg by Yasar, Raciborski, Poi (2008)
Date   Sat, 3 Mar 2012 08:23:33 +0000

On this evidence my guess was wrong and sorry, but I don't have
another one. I haven't tried to understand the logic of what you are
trying to code. Brian Poi is your man and will probably pick this up.

It's a side-detail, but -list-ing -tax_code- and -firm_op- serves no
useful purpose until you change the display -format- to something that
shows all the digits, say %12.0f.

Nick

On Fri, Mar 2, 2012 at 11:32 PM, Michel Serafinelli
<[email protected]> wrote:
> Dear Nick,
>
> Thanks for your message.
>
> However, I am still puzzled, because tax_code and firmid_op are stored
> as double (see output below under -describe-) and still
> the exit variable is wrong.
>
> I would really appreciate any suggestions.
>
> I understand that this is a issue not strictly related to -opreg- but
> I decided to mention the paper
>
> Yasar, Raciborski, Poi (2008)
> “Production function estimation in Stata using the Olley and Pakes method”
> The Stata Journal (2008) 8, Number 2, pp. 221–231
>
> because they show how to construct the exit variable, and I was
> puzzled by the fact
> that using their commands I could not create the right exit variable.
>
> Plus, I think the procedure by
>
> Olley, G. S., and A. Pakes. 1996. The dynamics of productivity in the
> telecommunications
> equipment industry. Econometrica 64: 1263–1297
>
> implemented by -opreg- is one of the best known examples in which the
> exit of a firm is important.
>
> That is why I mentioned opreg. I am sorry if this created confusion.
>
> I copy below the new output from the log file.
>
> Best,
>
> Michel
>
>
> . xtset tax_code year
>       panel variable:  tax_code (unbalanced)
>        time variable:  year, 1995 to 2001, but with gaps
>                delta:  1 unit
>
> .
> . gen double firmid_op=tax_code
>
> . des
>
> Contains data from dataset_for_opreg.dta
>  obs:        17,032
>  vars:             4                          1 Mar 2012 20:31
>  size:       579,088 (99.9% of memory free)   (_dta has notes)
> ------------------------------------------------------------------------------------------------------------------------------------
>              storage  display     value
> variable name   type   format      label      variable label
> ------------------------------------------------------------------------------------------------------------------------------------
> year            float  %10.0g
> matr_az         str10  %10s
> tax_code        double %10.0g
> firmid_op       double %10.0g
> ------------------------------------------------------------------------------------------------------------------------------------
> Sorted by:  tax_code  year
>     Note:  dataset has changed since last saved
>
> . duplicates list tax_code year
>
> Duplicates in terms of tax_code year
>
> (0 observations are duplicates)
>
> . duplicates list firmid_op year
>
> Duplicates in terms of firmid_op year
>
> (0 observations are duplicates)
>
> .
> . sort firmid_op year
>
> . by firmid_op: gen count = _N
>
> . * my dataset is for the period 95-2001 while YRP have data for 95-2002
> . gen survivor = count == 7
>
> . gen has95 = 1 if year == 2001
> (14464 missing values generated)
>
> . sort firmid_op has95
>
> . by firmid_op: replace has95 = 1 if has95[_n-1] == 1
> (10848 real changes made)
>
> . replace has95 = 0 if has95 == .
> (3616 real changes made)
>
> . sort firmid_op year
>
> . by firmid_op: gen has_gaps = 1 if year[_n-1] != year-1 & _n != 1
> (16414 missing values generated)
>
> . sort firmid_op has_gaps
>
> . by firmid_op: replace has_gaps = 1 if has_gaps[_n-1] == 1
> (1921 real changes made)
>
> . replace has_gaps = 0 if has_gaps == .
> (14493 real changes made)
>
> . by firmid_op: generate exit = survivor == 0 & has95 == 0 & has_gaps
> != 1 & _n == _N
>
> . replace exit = 0 if exit == 1 & year == 2001
> (0 real changes made)
>
> . * now we can see that this is not working
> . xtset firmid_op year
>       panel variable:  firmid_op (unbalanced)
>        time variable:  year, 1995 to 2001, but with gaps
>                delta:  1 unit
>
> . *note: matr_az is the string variable corresponding to the
> identifier "tax_code/firmid_op" (1:1 relantionship between the two)
> . br
>
> . list in 1/30
>
>     +----------------------------------------------------------------------------------------+
>     | year      matr_az    tax_code   firmid_op   count   survivor
> has95   has_gaps   exit |
>     |----------------------------------------------------------------------------------------|
>  1. | 1995   1000009303   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  2. | 1996   1000009303   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  3. | 1997   1000009303   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  4. | 1998   1000009303   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  5. | 1999   1000009303   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>     |----------------------------------------------------------------------------------------|
>  6. | 2000   1000009303   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  7. | 2001   1000009303   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  8. | 1996   1000022830   1.000e+09   1.000e+09       6          0
>   1          0      0 |
>  9. | 1997   1000022830   1.000e+09   1.000e+09       6          0
>   1          0      0 |
>  10. | 1998   1000022830   1.000e+09   1.000e+09       6          0
>   1          0      0 |
>     |----------------------------------------------------------------------------------------|
>  11. | 1999   1000022830   1.000e+09   1.000e+09       6          0
>   1          0      0 |
>  12. | 2000   1000022830   1.000e+09   1.000e+09       6          0
>   1          0      0 |
>  13. | 2001   1000022830   1.000e+09   1.000e+09       6          0
>   1          0      0 |
>  14. | 1995   1000028092   1.000e+09   1.000e+09       6          0
>   0          0      0 |
>  15. | 1996   1000028092   1.000e+09   1.000e+09       6          0
>   0          0      0 |
>     |----------------------------------------------------------------------------------------|
>  16. | 1997   1000028092   1.000e+09   1.000e+09       6          0
>   0          0      0 |
>  17. | 1998   1000028092   1.000e+09   1.000e+09       6          0
>   0          0      1 |
>  18. | 1999   1000028092   1.000e+09   1.000e+09       6          0
>   0          0      0 |
>  19. | 2000   1000028092   1.000e+09   1.000e+09       6          0
>   0          0      0 |
>  20. | 1995   1000035962   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>     |----------------------------------------------------------------------------------------|
>  21. | 1996   1000035962   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  22. | 1997   1000035962   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  23. | 1998   1000035962   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  24. | 1999   1000035962   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  25. | 2000   1000035962   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>     |----------------------------------------------------------------------------------------|
>  26. | 2001   1000035962   1.000e+09   1.000e+09       7          1
>   1          0      0 |
>  27. | 1996   1000039407   1.000e+09   1.000e+09       3          0
>   0          0      0 |
>  28. | 1997   1000039407   1.000e+09   1.000e+09       3          0
>   0          0      1 |
>  29. | 1998   1000039407   1.000e+09   1.000e+09       3          0
>   0          0      0 |
>  30. | 1996   1000053348   1.000e+09   1.000e+09       5          0
>   1          1      0 |
>     +----------------------------------------------------------------------------------------+
>
>
>
>
>
> -------------------------------------------------------------------------------------------------------------------
> From      Nick Cox <[email protected]>
> To        [email protected]
> Subject           Re: st: exit variable in opreg by Yasar, Raciborski, Poi (2008)
> Date      Fri, 2 Mar 2012 08:01:45 +0000
>
> I suspect a precision problem with your firm identifiers which are all
> displayed here as 1e9. I guess these should be very slightly different
> but the values have (by default) been put in a -float- variable and
> come out as identical in some cases where they should be different.
> Use a -double- instead and check your data. Consider as an equivalent
> example
>
> . set obs 10
> obs was 0, now 10
>
> . gen id = 1e9
>
> . replace id = id + 1 in 6/L
> (0 real changes made)
>
> . l
>
>     +----------+
>     |       id |
>     |----------|
>  1. | 1.00e+09 |
>  2. | 1.00e+09 |
>  3. | 1.00e+09 |
>  4. | 1.00e+09 |
>  5. | 1.00e+09 |
>     |----------|
>  6. | 1.00e+09 |
>  7. | 1.00e+09 |
>  8. | 1.00e+09 |
>  9. | 1.00e+09 |
>  10. | 1.00e+09 |
>     +----------+
>
> . format id %12.0f
>
> . l
>
>     +------------+
>     |         id |
>     |------------|
>  1. | 1000000000 |
>  2. | 1000000000 |
>  3. | 1000000000 |
>  4. | 1000000000 |
>  5. | 1000000000 |
>     |------------|
>  6. | 1000000000 |
>  7. | 1000000000 |
>  8. | 1000000000 |
>  9. | 1000000000 |
>  10. | 1000000000 |
>     +------------+
>
> Around 1 billion, different integers cannot all be held as distinct
> values in a -float-. -search precision- for (many) explanations of
> this.
>
> This is nothing to do with -opreg-. By the way, your reference is
> incomplete: the journal, volume and pages is not given. On Statalist
> we ask for the same standards with references as you would expect in
> decent published papers.
>
> Nick
>
> On Fri, Mar 2, 2012 at 4:46 AM, Michel Serafinelli
> <[email protected]> wrote:
>
>> I want to use the opreg routine by Yasar, Raciborski, Poi (2008)
>> “Production function estimation in Stata using the Olley and Pakes
>> method” (YRP)
>>
>>  In this routine exit is a dummy with 1 indicating the firm exited in
>> the current period.
>>
>> at pag 227 of their article, YRP show the commands on how to construct
>> the exit variable.
>>
>> However this does not seem to work for me.
>>
>> I copy the log file below in which I also list the first 30
>> observations in the dataset. You can see for instance in the
>> observation 16 and 28 of the dataset the variable exit takes value 1
>> even if the firm is not exiting.
>>
>> Please let me know if you have any suggestion, thanks!
>>
>
>> . xtset tax_code year
>>       panel variable:  tax_code (unbalanced)
>>        time variable:  year, 1995 to 2001, but with gaps
>>                delta:  1 unit
>>
>> . rename tax_code firmid_op
>>
>> . sort firmid_op year
>>
>> . by firmid_op: gen count = _N
>>
>> . * my dataset is for the period 95-2001 while YRP have data for 95-2002
>> . gen survivor = count == 7
>>
>> . gen has95 = 1 if year == 2001
>> (14464 missing values generated)
>>
>> . sort firmid_op has95
>>
>> . by firmid_op: replace has95 = 1 if has95[_n-1] == 1
>> (10848 real changes made)
>>
>> . replace has95 = 0 if has95 == .
>> (3616 real changes made)
>>
>> . sort firmid_op year
>>
>> . by firmid_op: gen has_gaps = 1 if year[_n-1] != year-1 & _n != 1
>> (16414 missing values generated)
>>
>> . sort firmid_op has_gaps
>>
>> . by firmid_op: replace has_gaps = 1 if has_gaps[_n-1] == 1
>> (1921 real changes made)
>>
>> . replace has_gaps = 0 if has_gaps == .
>> (14493 real changes made)
>>
>> . by firmid_op: generate exit = survivor == 0 & has95 == 0 & has_gaps
>> != 1 & _n == _N
>>
>> . replace exit = 0 if exit == 1 & year == 2001
>> (0 real changes made)
>>
>> . * now we can see that this is not working
>> . xtset firmid_op year
>>       panel variable:  firmid_op (unbalanced)
>>        time variable:  year, 1995 to 2001, but with gaps
>>                delta:  1 unit
>>
>> . *note: matr_az is the string variable corresponding to the
>> identifier "tax_code/firmid_op" (1:1 relantionship between the two)
>> . list in 1/30
>>
>>     +----------------------------------------------------------------------------+
>>     | year      matr_az   firmid_op   count   survivor   has95
>> has_gaps   exit |
>>     |----------------------------------------------------------------------------|
>>  1. | 1995   1000009303   1.000e+09       7          1       1
>>  0      0 |
>>  2. | 1996   1000009303   1.000e+09       7          1       1
>>  0      0 |
>>  3. | 1997   1000009303   1.000e+09       7          1       1
>>  0      0 |
>>  4. | 1998   1000009303   1.000e+09       7          1       1
>>  0      0 |
>>  5. | 1999   1000009303   1.000e+09       7          1       1
>>  0      0 |
>>     |----------------------------------------------------------------------------|
>>  6. | 2000   1000009303   1.000e+09       7          1       1
>>  0      0 |
>>  7. | 2001   1000009303   1.000e+09       7          1       1
>>  0      0 |
>>  8. | 1996   1000022830   1.000e+09       6          0       1
>>  0      0 |
>>  9. | 1997   1000022830   1.000e+09       6          0       1
>>  0      0 |
>>  10. | 1998   1000022830   1.000e+09       6          0       1
>>  0      0 |
>>     |----------------------------------------------------------------------------|
>>  11. | 1999   1000022830   1.000e+09       6          0       1
>>  0      0 |
>>  12. | 2000   1000022830   1.000e+09       6          0       1
>>  0      0 |
>>  13. | 2001   1000022830   1.000e+09       6          0       1
>>  0      0 |
>>  14. | 1995   1000028092   1.000e+09       6          0       0
>>  0      0 |
>>  15. | 1996   1000028092   1.000e+09       6          0       0
>>  0      0 |
>>     |----------------------------------------------------------------------------|
>>  16. | 1997   1000028092   1.000e+09       6          0       0
>>  0      1 |
>>  17. | 1998   1000028092   1.000e+09       6          0       0
>>  0      0 |
>>  18. | 1999   1000028092   1.000e+09       6          0       0
>>  0      0 |
>>  19. | 2000   1000028092   1.000e+09       6          0       0
>>  0      0 |
>>  20. | 1995   1000035962   1.000e+09       7          1       1
>>  0      0 |
>>     |----------------------------------------------------------------------------|
>>  21. | 1996   1000035962   1.000e+09       7          1       1
>>  0      0 |
>>  22. | 1997   1000035962   1.000e+09       7          1       1
>>  0      0 |
>>  23. | 1998   1000035962   1.000e+09       7          1       1
>>  0      0 |
>>  24. | 1999   1000035962   1.000e+09       7          1       1
>>  0      0 |
>>  25. | 2000   1000035962   1.000e+09       7          1       1
>>  0      0 |
>>     |----------------------------------------------------------------------------|
>>  26. | 2001   1000035962   1.000e+09       7          1       1
>>  0      0 |
>>  27. | 1996   1000039407   1.000e+09       3          0       0
>>  0      0 |
>>  28. | 1997   1000039407   1.000e+09       3          0       0
>>  0      1 |
>>  29. | 1998   1000039407   1.000e+09       3          0       0
>>  0      0 |
>>
>

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