Announcement

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

  • Dickey Fuller test problem

    Hey Guys I hope you are doing well.

    I am trying to make Dickey Fuller test to test for unit roots and then I want to make a VAR model for growth productivity and growth export for Croatia. I have data from 2003 to 2012 for more than 64.000 firms. But when I run the command dfuller for my variable in Stata 12 I get an error (459) that sample may not include multiple panels. I already xtset my panel data which is unbalanced. What do you suggest for me? After doing the DF test i would like to run a VAR model for growthproductivity and growthexport.
    Here is my code:

    Code:
    clear
    input float firm int year float(growthtfp growthexp)
    201 2003 . .
    201 2004 .33881569 .
    201 2005 -.17207432 .
    201 2006 .47192192 .
    201 2007 -.13453388 .
    201 2008 -.24717045 .
    201 2009 -.18523502 .
    201 2010 -1.5485363 .
    201 2011 .70168686 .
    202 2003 .95038128 .
    202 2006 . .
    202 2007 .25359917 .
    202 2008 -.28764343 .
    202 2009 -.43756771 .
    202 2010 .49980736 -.53359604
    202 2011 -.6887207 .50001144
    202 2012 .08063412 .52244854
    204 2003 . .
    204 2004 -.15126801 .
    204 2005 -.12458897 .
    204 2007 .34955502 .
    204 2008 .5278101 .
    204 2009 -.05338955 .
    204 2010 .03894329 .
    204 2011 -.2994957 .
    204 2012 -.92936611 .
    205 2003 . .
    205 2005 .23685551 .
    205 2007 -.37987423 -2.6108513
    205 2008 .92860031 .
    205 2009 -.44887352 .
    205 2010 .3864603 4.9606047
    205 2011 -.11122036 -6.5568333
    205 2012 -.23620224 2.4473543
    206 2007 . .
    207 2003 . .
    209 2004 . .
    209 2005 -.08526993 .
    209 2006 .1163044 .
    209 2007 .23593521 .
    209 2008 -.18027687 .
    209 2009 -.19822025 .
    209 2010 -.04927063 .
    209 2011 -.02280807 .
    209 2012 .02850342 .
    211 2004 . .
    211 2007 .33381462 .
    211 2008 .42588806 .
    211 2009 .3920908 .
    211 2010 -.9196825 .
    211 2011 .32289886 .
    212 2004 . .
    212 2005 .25462914 .
    212 2006 .20870209 .
    212 2007 .36477089 .
    215 2004 . .
    215 2005 1.5399866 .
    215 2006 -.43504906 .
    215 2007 .01071644 .
    215 2008 .30375767 .
    215 2009 -.21310425 .
    215 2010 -.05242252 .
    215 2011 .04187584 .
    215 2012 -.2951479 .
    218 2003 . .
    218 2004 .33166981 .
    218 2006 -.22263718 .
    218 2007 -.03172112 -.21253014
    218 2008 -.11574554 -1.4677296
    218 2009 .21086216 1.3805637
    218 2010 .00358105 -.52448654
    218 2011 -.06929111 .51715374
    218 2012 .00861645 -.32831097
    220 2003 . .
    220 2005 -1.0071678 .
    220 2006 .45889854 .
    220 2007 1.1440783 .
    220 2008 .10776901 .
    220 2009 -.85040092 .
    220 2010 .53544998 .
    220 2011 -1.8175049 .
    220 2012 .89534473 .
    223 2003 . .
    223 2004 -.20852757 .
    223 2006 .50251579 .
    223 2007 -.46890736 .
    223 2008 .0975256 .
    223 2009 .13470268 .
    223 2010 .565938 .
    223 2011 -.3130312 .
    223 2012 -.33418751 .
    224 2004 . .
    225 2004 . .
    225 2005 .01844883 .
    227 2003 .31607723 .
    227 2004 . .
    227 2005 -.09313488 .
    227 2006 -.12999725 .
    227 2007 .35443783 .
    227 2008 .1342926 .
    227 2009 -.09089279 .
    227 2010 -.07043457 .
    227 2011 -.2537632 .
    228 2003 . .
    228 2004 -.27766037 .
    228 2005 -.33545208 .
    228 2006 .25664711 1.857501
    228 2007 .22931671 1.5663939
    228 2008 .17338276 -.76774311
    228 2009 -.27063179 .04337788
    228 2010 .2204504 .95364857
    228 2011 -.30223274 .43293571
    229 2011 . .
    end
    Thanks in advance

  • #2
    You are using time-series commands on panel data, resulting in your error. The right command for tests for unit roots in panel data is xtunitroot. You may find more information on this command by typing

    Code:
    help xtunitroot
    A lot of the options do not allow for unbalanced panels, but a few do (e.g., fisher). In your case, testing whether growthfp is stationary and assuming 2 lags can be done as follows:


    Code:
     xtunitroot fisher  growthtfp, dfuller lags(2)

    For some empirical examples of how to implement panel VARs in Stata, the following paper may be useful:

    http://paneldataconference2015.ceu.h...ael-Abrigo.pdf

    Comment


    • #3
      Andrew thank you so much for your response... But I still have a problem. I get missing values generated, and I cannot compute test for ALL of my panels..I don't understand why I don't get any results?? And i tried with other variables as well,. and the problem persist.. can you help me again please?

      Comment


      • #4
        Your problem is one of data... you have too many missing values! Even though some of these tests can handle unbalanced panels, if the problem is too severe, then you will not be able to compute the test statistics. Consider the result for growthtfp



        Code:
        . xtunitroot fisher  growthtfp, dfuller lags(2)
        (18 missing values generated)
        could not compute test for panel 7
        could not compute test for panel 12
        
        Fisher-type unit-root test for growthtfp
        Based on augmented Dickey-Fuller tests
        ----------------------------------------
        Ho: All panels contain unit roots           Number of panels       =     14
        Ha: At least one panel is stationary        Avg. number of periods =   6.79
        
        AR parameter: Panel-specific                Asymptotics: T -> Infinity
        Panel means:  Included
        Time trend:   Not included
        Drift term:   Not included                  ADF regressions: 2 lags
        ------------------------------------------------------------------------------
                                          Statistic      p-value
        ------------------------------------------------------------------------------
         Inverse chi-squared(24)   P        48.7451       0.0020
         Inverse normal            Z        -1.8774       0.0302
         Inverse logit t(29)       L*       -4.1551       0.0001
         Modified inv. chi-squared Pm        3.5716       0.0002
        ------------------------------------------------------------------------------
         P statistic requires number of panels to be finite.
         Other statistics are suitable for finite or infinite number of panels.
        ------------------------------------------------------------------------------


        You have total number of panels equal to 14 (implying that 14 firms have growthtfp values repeated over a number of years. The test cannot be performed for panel 7 and panel 12 due to too few observations. Let us examine what these firms are by taking duplicates in terms of firm (we exclude panels (firms) with only one observation).

        Code:
        duplicates tag firm, gen(count)
        replace count=. if count==0
        Count the number of firms below and note that they are 14 corresponding to the total number of panels in the test. Now you can see that panel 7 and panel 12 are excluded because of few observations


        Code:
        . tab firm count
        
                   |                         count
              firm |         1          3          5          7          8 |     Total
        -----------+-------------------------------------------------------+----------
               201 |         0          0          0          0          9 |         9
               202 |         0          0          0          8          0 |         8
               204 |         0          0          0          0          9 |         9
               205 |         0          0          0          8          0 |         8
               209 |         0          0          0          0          9 |         9
               211 |         0          0          6          0          0 |         6
               212 |         0          4          0          0          0 |         4
               215 |         0          0          0          0          9 |         9
               218 |         0          0          0          0          9 |         9
               220 |         0          0          0          0          9 |         9
               223 |         0          0          0          0          9 |         9
               225 |         2          0          0          0          0 |         2
               227 |         0          0          0          0          9 |         9
               228 |         0          0          0          0          9 |         9
        -----------+-------------------------------------------------------+----------
             Total |         2          4          6         16         81 |       109
        
        
        . list  firm growthtfp if firm==212
        
             +-----------------+
             | firm   growt~fp |
             |-----------------|
         52. |  212   .2087021 |
         53. |  212   .2546291 |
         54. |  212   .3647709 |
         55. |  212          . |
             +-----------------+
        
        . list  firm growthtfp if firm==225
        
             +-----------------+
             | firm   growt~fp |
             |-----------------|
         93. |  225   .0184488 |
         94. |  225          . |
             +-----------------+
        
        .

        For your second variable, growthexp, you will not get any results because you have 94/113 = 83.19% missing values.

        Code:
        . count if  growthexp==.
           94

        With fewer missing values, one can suggest imputation but in your case where you have in excess of 80 percent of values missing for some variables, this would not be a sound idea. Your only recourse is to look for better data if you want to successfully perform your investigation.
        Last edited by Andrew Musau; 19 Jan 2016, 17:43.

        Comment


        • #5
          Andrews thank you again, you are right. The problem was in my data. I really have a lot of missing values for growthexp. But if i do the xtunitroot fisher growthtfp, dfuller lags(2) i realy don't get any result for any of my panels. I tried to find the missing values for all my variables with the mdesc command and for growthtfp i have only 22% number of missing values. it's very strange.. But anyway thanks a lot for your answer..The explanation is very clear..

          Comment

          Working...
          X