Lab 4 - Ekonometrika 2 (2012) - Time Series 2 (STATA)


Ekonometrika 2
Program S1 Ilmu Ekonomi FEUI
Maret 2012

Lab ke-4
Analisis Time Series 2
(STATA)

SOAL A

Gunakan data PHILLIPS.dat dengan deskripsi variable di PHILLIPS.txt.

. use “http://fmwww.bc.edu/ec-p/data/wooldridge/PHILLIPS.dta”

. *Lakukan set time data terlebih dahulu sebelum melakukan estimasi times series
. tsset year
        time variable:  year, 1948 to 1996
                delta:  1 unit

  • Lakukan pengujian apakah terdapat serial correlation pada masing –masing model di bawah ini
(i)  Model statis statis kurva Phllips (1) 

          inft=b0+b1unemt+ut                             (1)

       . quietly reg inf unem
       . dwstat
       Durbin-Watson d-statistic(  2,    49) =  .8027005

       . bgodfrey
              Breusch-Godfrey LM test for autocorrelation
       ---------------------------------------------------------------------------
           lags(p)  |          chi2               df                 Prob > chi2
       -------------+-------------------------------------------------------------
              1     |         18.472               1                   0.0000
       ---------------------------------------------------------------------------
                               H0: no serial correlation

       . predict u1, resid
       . reg u1 L.u1

             Source |       SS       df       MS              Number of obs =      48
       -------------+------------------------------           F(  1,    46) =   24.34
              Model |   150.91704     1   150.91704           Prob > F      =  0.0000
           Residual |  285.198412    46  6.19996547           R-squared     =  0.3460
       -------------+------------------------------           Adj R-squared =  0.3318
              Total |  436.115452    47  9.27905217           Root MSE      =    2.49
      ------------------------------------------------------------------------------
                u1 |      Coef.   Std. Err.      t    P>|t|    [95% Conf. Interval]      
      -------------+----------------------------------------------------------------
                u1 |
               L1. |   .5729695   .1161334     4.93   0.000     .3392052    .8067338
                   |
             _cons |  -.1133967    .359404    -0.32   0.754    -.8368393     .610046
      ------------------------------------------------------------------------------

(ii) Dinamik kurva Phillips-1 (kurva Philips dengan asumsi angka pengangguran alamiah konstan)  (2) 

cinf=d0+d1unem+e                  (2)

       . quietly reg cinf unem
       . dwstat

       Durbin-Watson d-statistic(  2,    48) =  1.769648
        
       . bgodfrey

       Breusch-Godfrey LM test for autocorrelation
       ---------------------------------------------------------------------------
           lags(p)  |          chi2               df                 Prob > chi2
       -------------+-------------------------------------------------------------
              1     |          0.062               1                   0.8039
       ---------------------------------------------------------------------------
                               H0: no serial correlation

       . predict u2, resid
       (1 missing value generated)

       . reg u2 L.u2

             Source |       SS       df       MS              Number of obs =      47
       -------------+------------------------------           F(  1,    45) =    0.08
              Model |  .350023904     1  .350023904           Prob > F      =  0.7752
           Residual |  190.837373    45  4.24083051           R-squared     =  0.0018
       -------------+------------------------------           Adj R-squared = -0.0204
              Total |  191.187397    46  4.15624776           Root MSE      =  2.0593

       ------------------------------------------------------------------------------
                 u2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
       -------------+----------------------------------------------------------------
                 u2 |
                L1. |  -.0355928   .1238908    -0.29   0.775    -.2851216     .213936
                    |
              _cons |   .1941655   .3003839     0.65   0.521    -.4108387    .7991698
       ------------------------------------------------------------------------------

(iii) Dinamik kurva Phillips-2 (kurva Philips dengan asumsi angka pengangguran merupakan fungsi dari angka pengangguran pada periode sebelumnya)   (3)

cinf=q0+q1cunem+e                 (3)

       . quietly reg cinf cunem
       . dwstat

       Durbin-Watson d-statistic(  2,    48) =  1.849401

       . bgodfrey
       Breusch-Godfrey LM test for autocorrelation
       ---------------------------------------------------------------------------
           lags(p)  |          chi2               df                 Prob > chi2
       -------------+-------------------------------------------------------------
              1     |          0.042               1                   0.8385
       ---------------------------------------------------------------------------
                               H0: no serial correlation

       . predict u3, resid
       (1 missing value generated)

       . reg u3 L.u3

            Source |       SS       df       MS              Number of obs =      47
      -------------+------------------------------           F(  1,    45) =    0.05
             Model |  .215297942     1  .215297942           Prob > F      =  0.8313
          Residual |  210.917548    45  4.68705663           R-squared     =  0.0010
      -------------+------------------------------           Adj R-squared = -0.0212
             Total |  211.132846    46  4.58984449           Root MSE      =   2.165

      ------------------------------------------------------------------------------
                u3 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
                u3 |
               L1. |  -.0283512   .1322822    -0.21   0.831    -.2947812    .2380788
                   |
             _cons |   .1585139   .3157922     0.50   0.618    -.4775242     .794552
      ------------------------------------------------------------------------------

  • Bandingkan hasil pengujian dari ketiga model di atas, dan beri analisis anda tentang persamaan dan/atau perbedaan hasil pengujian di atas.
. quietly reg inf unem
. estimates store inf
. quietly reg cinf unem
. estimates store cinf
. quietly reg cinf cunem
. estimates store cinf2
. estimates table inf cinf cinf2 , stat(N r2 r2_a aic bic)  b(%7.4f) stfmt(%7.4g) star(0.1 0.05 0.01)

-----------------------------------------------------
    Variable |    inf          cinf        cinf2    
-------------+---------------------------------------
        unem |  0.4676      -0.5426**               
       cunem |                           -0.8422**  
       _cons |  1.4236       3.0306**    -0.0782    
-------------+---------------------------------------
           N |      49           48           48    
          r2 |  .05272        .1078         .135    
        r2_a |  .03257        .0884        .1162    
         aic |   252.9        224.2        222.7    
         bic |   256.6          228        226.5    
-----------------------------------------------------
                  legend: * p<.1; ** p<.05; *** p<.01

  • Lakukan pengujian Unit Root untuk mendeteksi stationaritas data inflasi dan data pengangguran dengan menggunakan regresi ADF model. Beri intrepretasi terhadap hasil pengujian anda!. Berdasarkan hasil pengujian ini, apakah anda mendeteksi adanya regresi palsu (spurious regression)?
      . * Lakukan pengujian Unit Root untuk mendeteksi stationaritas data inflasi dan data pengangguran dengan menggunakan regresi ADF

      . dfuller inf, regres trend

      Dickey-Fuller test for unit root                   Number of obs   =        48

                                     ---------- Interpolated Dickey-Fuller ---------
                        Test         1% Critical       5% Critical      10% Critical
                     Statistic           Value             Value             Value
      ------------------------------------------------------------------------------
       Z(t)             -3.449            -4.168            -3.508            -3.185
      ------------------------------------------------------------------------------ 
      MacKinnon approximate p-value for Z(t) = 0.0452

      ------------------------------------------------------------------------------
      D.inf        |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
               inf |
               L1. |  -.3856691   .1118259    -3.45   0.001    -.6108981   -.1604402
            _trend |   .0362198   .0256589     1.41   0.165    -.0154598    .0878995
             _cons |   .5996598   .7310425     0.82   0.416    -.8727353    2.072055
      ------------------------------------------------------------------------------

      . dfuller unem, regres trend

      Dickey-Fuller test for unit root                   Number of obs   =        48

                                     ---------- Interpolated Dickey-Fuller ---------
                        Test         1% Critical       5% Critical      10% Critical
                     Statistic           Value             Value             Value
      ------------------------------------------------------------------------------
       Z(t)             -2.993            -4.168            -3.508            -3.185
      ------------------------------------------------------------------------------
      MacKinnon approximate p-value for Z(t) = 0.1340

      ------------------------------------------------------------------------------
      D.unem       |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
              unem |
               L1. |  -.3507138   .1171655    -2.99   0.004    -.5866972   -.1147303
            _trend |   .0164492   .0132111     1.25   0.220    -.0101593    .0430576
             _cons |   1.646202   .5768054     2.85   0.007     .4844567    2.807948
      ------------------------------------------------------------------------------

      . * kesimpulannya: data inflasi dan data pengangguran tidak stasioner

      . * uji spurious regression

      . quietly reg inf unem
      . predict error, resid
      . dfuller error, regres trend

      Dickey-Fuller test for unit root                   Number of obs   =        48

                                     ---------- Interpolated Dickey-Fuller ---------
                        Test         1% Critical       5% Critical      10% Critical
                     Statistic           Value             Value             Value
      ------------------------------------------------------------------------------
       Z(t)             -3.846            -4.168            -3.508            -3.185
      ------------------------------------------------------------------------------
      MacKinnon approximate p-value for Z(t) = 0.0144

      ------------------------------------------------------------------------------
      D.error      |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
             error |
               L1. |  -.4539094   .1180233    -3.85   0.000    -.6916206   -.2161982
            _trend |   .0304812    .026365     1.16   0.254    -.0226207    .0835831
             _cons |  -.8596548   .7381616    -1.16   0.250    -2.346388     .627079
      ------------------------------------------------------------------------------

      . * kesimpulannya: tidak spurious regression atau nenilkik kointergarsi karen nilai error stasioner

SOAL B 

Gunakan data Okun.dta
. use “http://fmwww.bc.edu/ec-p/data/wooldridge/okun.dta”

. *Lakukan set time data terlebih dahulu sebelum melakukan estimasi times series 
. tsset year
        time variable:  year, 1959 to 2005
                delta:  1 unit

  •  Estimasi persamaan di bawah ini dengan metode OLS
pcrgdpt=b0+b1∆unemt+ut                              (4)

     . reg  pcrgdp cunem

           Source |       SS       df       MS              Number of obs =      46
     -------------+------------------------------           F(  1,    44) =  107.92
            Model |  131.353664     1  131.353664           Prob > F      =  0.0000
         Residual |  53.5559029    44  1.21717961           R-squared     =  0.7104
     -------------+------------------------------           Adj R-squared =  0.7038
            Total |  184.909567    45  4.10910148           Root MSE      =  1.1033

     ------------------------------------------------------------------------------
           pcrgdp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
     -------------+----------------------------------------------------------------
            cunem-1.890915   .1820239   -10.39   0.000     -2.25776    -1.52407
            _cons |   3.344427   .1626743    20.56   0.000     3.016578    3.672275
     ------------------------------------------------------------------------------

  • Lakukan pengujian AR (1) serial correlation  dan berikan interpretasi anda terhadap hasil pengujian ini dan dikaitkan dengan estimasi parameter persamaan (4).

     . quietly reg  pcrgdp cunem

     . dwstat

     Durbin-Watson d-statistic(  2,    46) =  1.856618

     . bgodfrey

     Breusch-Godfrey LM test for autocorrelation
     ---------------------------------------------------------------------------
         lags(p)  |          chi2               df                 Prob > chi2
     -------------+-------------------------------------------------------------
            1     |          0.193               1                   0.6601
     ---------------------------------------------------------------------------
                             H0: no serial correlation

     . predict error, resid
     (1 missing value generated)

     . reg error L.error

           Source |       SS       df       MS              Number of obs =      45
     -------------+------------------------------           F(  1,    43) =    0.15
            Model |  .177626827     1  .177626827           Prob > F      =  0.7052
         Residual |  52.6493732    43  1.22440403           R-squared     =  0.0034
     -------------+------------------------------           Adj R-squared = -0.0198
            Total |      52.827    44  1.20061364           Root MSE      =  1.1065

     ------------------------------------------------------------------------------
            error |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
     -------------+----------------------------------------------------------------
            error |
              L1. |   .0580417   .1523871     0.38   0.705    -.2492761    .3653595
                  |
            _cons |   .0176032   .1649796     0.11   0.916      -.31511    .3503163
     ------------------------------------------------------------------------------

  • Hitung residual dari hasil estimasi di atas dan pangkatkan 2 (ût 2 ) dan lakukan pengujian untuk mendeteksi masalah heterokedastisitas dengan Breusch-Pagan test (run ût 2 terhadap ∆unemt )  dan berikan interprerasi anda
      . gen error2 = error^2
     (1 missing value generated)

     . reg error2 cunem

           Source |       SS       df       MS              Number of obs =      46
     -------------+------------------------------           F(  1,    44) =    4.27
            Model |  7.50942413     1  7.50942413           Prob > F      =  0.0447
         Residual |  77.3669243    44  1.75833919           R-squared     =  0.0885
     -------------+------------------------------           Adj R-squared =  0.0678
            Total |  84.8763484    45  1.88614108           Root MSE      =   1.326

     ------------------------------------------------------------------------------
           error2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
     -------------+----------------------------------------------------------------
            cunem |   .4521206   .2187773     2.07   0.045     .0112039    .8930373
            _cons |    1.16819   .1955208     5.97   0.000      .774144    1.562237
     ------------------------------------------------------------------------------
     . quietly reg  pcrgdp cunem

     . hettest

     Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
             Ho: Constant variance
              Variables: fitted values of pcrgdp

              chi2(1)      =     2.77
              Prob > chi2  =   0.0960
  • Estimasi kembali persaman (4) dengan menggunakan  metode WLS dan bandingkan hasil regresinya dengan hasil regresi dengan metode OLS, berikan analisis anda dikaitkan dengan pengujian untuk mendeteksi masalah heteroskedastis di atas.
      . reg  pcrgdp cunem [w=error2]
     (analytic weights assumed)
     (sum of wgt is   5.3556e+01)

           Source |       SS       df       MS              Number of obs =      46
     -------------+------------------------------           F(  1,    44) =   53.77
            Model |  153.069146     1  153.069146           Prob > F      =  0.0000
         Residual |   125.24728    44  2.84652908           R-squared     =  0.5500
     -------------+------------------------------           Adj R-squared =  0.5398
            Total |  278.316426    45  6.18480946           Root MSE      =  1.6872

     ------------------------------------------------------------------------------
           pcrgdp |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
     -------------+----------------------------------------------------------------
            cunem-1.740022   .2372842    -7.33   0.000    -2.218237   -1.261807
            _cons |   3.334796   .2588378    12.88   0.000     2.813143    3.856449
     ------------------------------------------------------------------------------

     . hettest

     Breusch-Pagan / Cook-Weisberg test for heteroskedasticity
              Ho: Constant variance
              Variables: fitted values of pcrgdp

              chi2(1)      =     0.08
              Prob > chi2  =   0.7808        


-------------------------------------------------

Komentar

Postingan populer dari blog ini

Linear Probability Model (LPM), Logit Model, dan Probit Model (Normit Model) dengan STATA (2011)

Random Effect Model (REM)

Ordinary Least Square (OLS) dengan STATA (2011)