Announcement

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

  • Exporting DF-GLS and Phillips-Perron Unit root tests into Latex

    Hi,

    I have done some preliminary unit root tests for some of the variables but I find it extremely time consuming to exporting each variable manually into Latex form.

    For example, this is my variable and the first difference..

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(quarter lprod Dlprod)
     80  12.13732             .
     81 12.101705   -.035614014
     82 12.085896    -.01580906
     83  12.04684    -.03905678
     84 12.071728     .02488899
     85 12.050054   -.021674156
     86  12.00326    -.04679394
     87 12.004496    .001235962
     88 11.989095   -.015400887
     89 11.960452   -.028642654
     90 11.980496    .020044327
     91  12.01027     .02977276
     92 11.940223   -.070046425
     93 11.960725     .02050209
     94 12.009465     .04874039
     95 12.011308   .0018424988
     96  12.00856   -.002747536
     97 12.014071    .005511284
     98  11.99644   -.017630577
     99 11.999317    .002876282
    100  11.99553   -.003787041
    101 11.972418   -.023112297
    102  11.97455    .002131462
    103 12.035333     .06078339
    104  12.02259   -.012742996
    105 12.037267    .014677048
    106 12.057285     .02001858
    107  12.03192    -.02536392
    108 12.012305   -.019616127
    109 12.019267    .006961823
    110 12.071442     .05217457
    111  12.06753  -.0039129257
    112 12.054868    -.01266098
    113  12.05971    .004841805
    114  12.07685    .017139435
    115 12.121812     .04496288
    116  12.07576    -.04605198
    117 12.084238    .008478165
    118 12.103356     .01911831
    119 12.124914     .02155781
    120 12.123683  -.0012311935
    121 12.119718   -.003965378
    122 12.083868    -.03584957
    123 12.108518     .02464962
    124 12.109262    .000743866
    125 12.086098   -.023163795
    126  12.10194    .015841484
    127 12.113782    .011842728
    128 12.108726   -.005056381
    129 12.091665    -.01706028
    130  12.09718    .005515099
    131 12.111823    .014642715
    132 12.111023  -.0008001328
    133 12.093852   -.017170906
    134 12.099945    .006093025
    135 12.109635    .009690285
    136 12.117045     .00741005
    137  12.11408  -.0029649734
    138   12.1156   .0015182495
    139  12.13338    .017782211
    140 12.132375  -.0010061264
    141   12.1355    .003125191
    142 12.145184     .00968361
    143  12.14872    .003537178
    144 12.156657    .007936478
    145 12.156556 -.00010108948
    146  12.15994     .00338459
    147  12.17632    .016378403
    148 12.187155    .010835648
    149 12.186235   -.000919342
    150 12.192647    .006411552
    151  12.20609    .013442993
    152 12.224665    .018574715
    153 12.216696   -.007968903
    154 12.199882   -.016814232
    155 12.205155    .005273819
    156 12.212488    .007332802
    157   12.1818   -.030688286
    158 12.192327    .010526657
    159  12.19558    .003252983
    160  12.20914     .01356125
    161 12.226406     .01726532
    162  12.24416    .017752647
    163 12.253895     .00973606
    164 12.241908   -.011986732
    165 12.218095    -.02381325
    166 12.227437    .009342194
    167 12.223634   -.003803253
    168 12.210117   -.013516426
    169 12.205342   -.004775047
    170 12.213876    .008533478
    171 12.231914    .018037796
    172 12.240483    .008569717
    173 12.233493   -.006990433
    174 12.242036   .0085430145
    175 12.271914    .029878616
    176   12.2812    .009285927
    177 12.283822    .002621651
    178 12.297336    .013513565
    179  12.30247    .005133629
    end
    format %tq quarter
    After testings for the presence of unit root, I want to illustrate that it is an I(1) series in levels but after first differencing the series, it becomes stationary. So I would like to show the test in levels and in first differences. Could anyone help me with a code please?

    Code:
    dfgls lprod, maxlag(0)
     
    DF-GLS for lprod                                         Number of obs =   147
     
                   DF-GLS tau      1% Critical       5% Critical      10% Critical
      [lags]     Test Statistic        Value             Value             Value
    ------------------------------------------------------------------------------
        0            -1.547           -3.522            -2.971            -2.680
    
    . pperron lprod
    
    Phillips-Perron test for unit root                 Number of obs   =       147
                                                       Newey-West lags =         4
    
                                   ---------- Interpolated Dickey-Fuller ---------
                      Test         1% Critical       5% Critical      10% Critical
                   Statistic           Value             Value             Value
    ------------------------------------------------------------------------------
     Z(rho)            0.431           -19.957           -13.794           -11.063
     Z(t)              0.290            -3.494            -2.887            -2.577
    ------------------------------------------------------------------------------
    MacKinnon approximate p-value for Z(t) = 0.9769
    
    . dfgls Dlprod, maxlag(0)
     
    DF-GLS for Dlprod                                        Number of obs =   146
     
                   DF-GLS tau      1% Critical       5% Critical      10% Critical
      [lags]     Test Statistic        Value             Value             Value
    ------------------------------------------------------------------------------
        0            -8.611           -3.524            -2.971            -2.681
    
    . pperron Dlprod
    
    Phillips-Perron test for unit root                 Number of obs   =       146
                                                       Newey-West lags =         4
    
                                   ---------- Interpolated Dickey-Fuller ---------
                      Test         1% Critical       5% Critical      10% Critical
                   Statistic           Value             Value             Value
    ------------------------------------------------------------------------------
     Z(rho)         -136.215           -19.953           -13.792           -11.061
     Z(t)            -12.996            -3.495            -2.887            -2.577
    ------------------------------------------------------------------------------
    MacKinnon approximate p-value for Z(t) = 0.0000
Working...
X