Friday, July 10, 2015

Regresi Data Panel dengan GRETL

Halo rekan

Pada kesempatan kali ini saya ingin berbagi tips cara melakukan analisis regresi data panel dengan menggunakan GRETL. Artikel ini sebenarnya masih bersifat draft, namun tetap saya publikasikan dengan pertimbangan belajar dan berbagi manfaat. Selain itu, ide yang melintas di pikiran ini kalau tidak segera dituangkan dalam bentuk tulisan, dikhawatirkan menguap begitu saja :-)

Software GRETL dapat diunduh GRATIS di sini

Tahapan-tahapan analisis data regresi data panel dengan menggunakan GRETL adalah sebagai berikut:

  1. File => Open Data => Import => Excel
  2. Pilih file yang akan diolah (file latihan, silahkan unduh di sini)
  3. "Do you want to give the data a time-series or panel interpretation?" klik Yes
  4. Pilih opsi Panel, lalu Forward
  5. Pilih Stacked time series, lalu Forward
  6. Number of Cross-sectional units: 4 (karena ada 4 perusahaan) dan Number of Periods: 20 (karena masing-masing perusahaan terdiri dari data 20 periode/ 20 tahun)
  7. Forward => Apply


A. Lakukan analisis OLS, klik Model => Ordinary Least Square

  1. Pilih Model => Ordinary Least Squares 
  2. Masukkan inv pada Dependent variable
  3. Masukkan p dan m pada Regressors
  4. Klik OK


Berikut ini hasilnya


Model 1: Pooled OLS, using 80 observations
Included 4 cross-sectional units
Time-series length = 20
Dependent variable: inv

             coefficient   std. error   t-ratio    p-value
  ---------------------------------------------------------
  const      -62,1311      29,6331      -2,097    0,0393    **
  p            0,110096     0,0137297    8,019    9,36e-012 ***
  m            0,303393     0,0492957    6,155    3,15e-08  ***

Mean dependent var   292,9154   S.D. dependent var   284,8528
Sum squared resid     1560690   S.E. of regression   142,3682
R-squared            0,756528   Adjusted R-squared   0,750204
F(2, 77)             119,6292   P-value(F)           2,39e-24
Log-likelihood      -508,6596   Akaike criterion     1023,319
Schwarz criterion    1030,465   Hannan-Quinn         1026,184
rho                  0,939390   Durbin-Watson        0,210515

B. Lakukan analisis Panel (Fix), klik Model => Panel => Fix/Random Effects
Gambar 1. Specify Model

Hasilnya adalah sebagai berikut:
Model 2: Fixed-effects, using 80 observations
Included 4 cross-sectional units
Time-series length = 20
Dependent variable: inv

             coefficient   std. error   t-ratio    p-value
  ---------------------------------------------------------
  const      -72,7577      37,5490      -1,938    0,0565    *
  p            0,107948     0,0175089    6,165    3,38e-08  ***
  m            0,346162     0,0266645   12,98     9,27e-021 ***

Mean dependent var   292,9154   S.D. dependent var   284,8528
Sum squared resid    419462,9   S.E. of regression   75,28890
R-squared            0,934563   Adjusted R-squared   0,930141
F(5, 74)             211,3706   P-value(F)           2,47e-42
Log-likelihood      -456,1032   Akaike criterion     924,2065
Schwarz criterion    938,4986   Hannan-Quinn         929,9366
rho                  0,603379   Durbin-Watson        0,776889

Test for differing group intercepts -
  Null hypothesis: The groups have a common intercept
  Test statistic: F(3, 74) = 67,1102
  with p-value = P(F(3, 74) > 67,1102) = 4,59178e-021


C. Lakukan analisis Panel (Random), klik Model => Panel => Fix/Random Effects
Gambar 2. Specify Model

Hasilnya adalah sebagai berikut:
Model 3: Random-effects (GLS), using 80 observations
Included 4 cross-sectional units
Time-series length = 20
Dependent variable: inv

             coefficient   std. error   t-ratio    p-value
  ---------------------------------------------------------
  const      -71,9420      83,9603      -0,8569   0,3942
  p            0,107655     0,0168169    6,402    1,10e-08  ***
  m            0,345710     0,0265451   13,02     3,75e-021 ***

Mean dependent var   292,9154   S.D. dependent var   284,8528
Sum squared resid     1578718   S.E. of regression   142,2673
Log-likelihood      -509,1190   Akaike criterion     1024,238
Schwarz criterion    1031,384   Hannan-Quinn         1027,103

'Within' variance = 5668,42
'Between' variance = 23435,5
theta used for quasi-demeaning = 0,890029

Breusch-Pagan test -
  Null hypothesis: Variance of the unit-specific error = 0
  Asymptotic test statistic: Chi-square(1) = 379,08
  with p-value = 1,97363e-084

Hausman test -
  Null hypothesis: GLS estimates are consistent
  Asymptotic test statistic: Chi-square(2) = 1,57245
  with p-value = 0,455561

D. Pemilihan Model Terbaik (Common Effects, Fixed Effects, Random Effects)
Inilah keunggulan GRETL dibandingkan program lain (misal EVIEWS), dari output model:
  1. Klik Test => Panel Diagnostic
  2. Hasilnya adalah sebagai berikut
      Diagnostics: assuming a balanced panel with 4 cross-sectional units
                         observed over 20 periods

Fixed effects estimator
allows for differing intercepts by cross-sectional unit
slope standard errors in parentheses, p-values in brackets

       const:        -72,758        (37,549)       [0,05648]
           p:        0,10795      (0,017509)       [0,00000]
           m:        0,34616      (0,026664)       [0,00000]

4 group means were subtracted from the data

Residual variance: 419463/(80 - 6) = 5668,42
Joint significance of differing group means:
 F(3, 74) = 67,1102 with p-value 4,59178e-021
(A low p-value counts against the null hypothesis that the pooled OLS model
is adequate, in favor of the fixed effects alternative.)
=============================================
Artinya:
Pooled/Common Effects (CE) VS Fixed Effects (FE)
Sehingga dikarenakan nilai Prob < 0,05, maka yang terpilih adalah model FE
=============================================
Means of pooled OLS residuals for cross-sectional units:

 unit  1:       -169,54
 unit  2:       -2,4891
 unit  3:        165,73
 unit  4:        6,2993

Breusch-Pagan test statistic:
 LM = 379,08 with p-value = prob(chi-square(1) > 379,08) = 1,97363e-084
(A low p-value counts against the null hypothesis that the pooled OLS model
is adequate, in favor of the random effects alternative.)
=============================================
Artinya:
Pooled/Common Effects (CE) VS Random Effects (RE)
Sehingga dikarenakan nilai Prob < 0,05, maka yang terpilih adalah model RE
=============================================

Variance estimators:
 between = 23435,5
 within = 5668,42
theta used for quasi-demeaning = 0,890029

                         Random effects estimator
           allows for a unit-specific component to the error term
           (standard errors in parentheses, p-values in brackets)

          const:        -71,942         (83,96)       [0,39418]
              p:        0,10766      (0,016817)       [0,00000]
              m:        0,34571      (0,026545)       [0,00000]

Hausman test statistic:
 H = 1,57245 with p-value = prob(chi-square(2) > 1,57245) = 0,455561
(A low p-value counts against the null hypothesis that the random effects
model is consistent, in favor of the fixed effects model.)
=============================================
Artinya:
Random Effects (RE) VS Fixed Effects (FE)
Sehingga dikarenakan nilai Prob > 0,05, maka yang terpilih adalah model RE
=============================================
RE terpilih 2 kali dan FE terpilih 1 kali, sehingga model terbaik dalam contoh kasus ini adalah model Random Effects, dengan hasil sebagai berikut:

             coefficient   std. error   t-ratio    p-value
  ---------------------------------------------------------
  const      -71,9420      83,9603      -0,8569   0,3942
  p            0,107655     0,0168169    6,402    1,10e-08  ***
  m            0,345710     0,0265451   13,02     3,75e-021 ***

Mean dependent var   292,9154   S.D. dependent var   284,8528
Sum squared resid     1578718   S.E. of regression   142,2673
Log-likelihood      -509,1190   Akaike criterion     1024,238
Schwarz criterion    1031,384   Hannan-Quinn         1027,103

Demikian, semoga bermanfaat
Salam

5 comments:

  1. Terima kasih...ulasan yang menarik dan sangat membantu. Materi yang disampaikan sangat jelas dan mudah dipahami. terima kasih saya sangat terbantu :)

    ReplyDelete
  2. maaf R-Square model Random effect yang mana?

    ReplyDelete
  3. pada langkah awal yg mengisi number of cross sectional units dan time periods knp gretl saya tidak bisa mengisi sesuai data saya 4 dan 30 ya ? otomatis 2 : 15 atau 3 : 10

    ReplyDelete