Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • problem with xtserial

    Hi

    I have a panel data:
    Code:
     xtset NPC_FIC year
    
    Panel variable: NPC_FIC (weakly balanced)
     Time variable: year, 2010 to 2020
             Delta: 1 unit
    clear
    input double(year NPC_FIC) float(ln_mig_firm immi_sh) double firm_age float foreign_aff
    2011 500027353         .  .07327854  12 1
    2017 500049799   1.94591   .2563815  29 1
    2011 500050215         .  .07327854  17 1
    2018 500135017 1.3862944 .026183223  35 1
    2012 500139105         .   .1458695   7 1
    2016 500205042   2.70805   .1458695   3 1
    2018 500206942         . .026183223  48 1
    2018 500251226         . .026183223  14 1
    2010 500265754         .  .05727747  17 1
    2019 500301113         .  .07327854  18 1
    2016 500321035         . .026183223  14 1
    2010 500369375         .   .2563815  14 1
    2010 500392001         .  .07327854   6 1
    2010 500458395         . .026183223  14 1
    2010 500508011         .  .07327854  14 1
    2012 500526935         .  .05727747  17 1
    2017 500979142 3.8066626 .026183223 151 0
    2015 500979162         . .026183223  37 1
    2015 500979176 1.0986123   .1458695  39 1
    2016 500979181         .   .1458695  42 1
    2015 500979182 3.2580965   .1458695  86 1
    2012 500979184         . .026183223  38 1
    2019 500979220         0 .026183223  70 1
    2017 500979228 1.0986123   .1458695  21 1
    2019 500979237         . .026183223  39 1
    2013 500979239  1.609438 .026183223  37 1
    2018 500979255 1.7917595  .05727747  67 1
    2011 500979261         .   .2563815  66 1
    2017 500979265  2.995732   .1458695  57 1
    2014 500979266         . .026183223  44 1
    2019 500979269  1.609438  .05727747  45 1
    2011 500979271         . .026183223  71 1
    
    . 
    end of do-file
    
    . tab year
    
           Year |      Freq.     Percent        Cum.
    ------------+-----------------------------------
           2010 |      5,702       22.41       22.41
           2011 |      3,741       14.71       37.12
           2012 |      2,356        9.26       46.38
           2013 |      2,025        7.96       54.34
           2014 |      2,026        7.96       62.30
           2015 |      1,737        6.83       69.13
           2016 |      1,610        6.33       75.46
           2017 |      1,623        6.38       81.84
           2018 |      1,532        6.02       87.86
           2019 |      1,526        6.00       93.86
           2020 |      1,562        6.14      100.00
    ------------+-----------------------------------
          Total |     25,440      100.00
    When I run
    Code:
    xtserial ln_mig_firm immi_sh firm_age foreign_aff 
    no observations
    r(2000);
    Any ideas appreciated.

    Cheers,
    Paris


  • #2
    To test for first-order serial correlation, you need to run a regression on the first-differenced variables. Your variable "ln_mig_firm" has too many missing values and mostly in non-consecutive years, so once you take differences, your entire dataset is wiped out. See

    Code:
    help xtserial

    under Methods and Formulas. In any case, why are you testing for serial correlation? Just assume that it exists and implement methods that are robust to it.
    Last edited by Andrew Musau; 08 Apr 2023, 15:48.

    Comment

    Working...
    X