APLIKASI DATA PANEL
DI STATA
Oleh :
Akbar Suwardi
Outline
I. Pengenalan Data Panel
1. Kuadrat Terkecil (Pooled Least Square) 2. Efek Tetap (Fixed Effect)
3. Efek Acak (Random Effect)
II. Pemilihan Metode Estimasi dalam Panel Data
1. Pemilihan Kuadrat Terkecil (Pooled Least Square) atau Efek Tetap (Fixed Effect) 2. Pemilihan Efek Tetap (Fixed Effect) atau Efek Acak (Random Effect)
3. Pemilihan Kuadrat Terkecil (Pooled Least Square) atau Efek Acak (Random Effect) III. Evaluasi Hasil Regresi Data Panel
1. Kriteria Teori 2. Kriteria Statistik
a. Uji signifikansi serentak (F-Test). b. Uji Signifikansi parsial (t-test). c. Uji Goodness of Fit.
3. Kriteria Ekonometrika
a. Bebas dari Multikolinearitas b. Bebas dari Heteroskedastisitas c. Bebas dari Autokorelasi
IV. Robust Method dan General Least Square (GLS) I. Robust Method: PLS & FE
I. Pengenalan Data Panel
•
Gunakan data
–
Data dari Buku Gujarati (2003), chpater 16
mengenai
•
Lakukan Set Panel Data
Xtset individu time, year
Panel variable: individu (strongly balanced)
Time variable: time, 1935 to 1954
I. Pengenalan Data Panel
•
Mengenal data Panel
. xtsum y x2 x3
Variable | Mean Std. Dev. Min Max | Observations ---+---+--- y overall | 290.9154 284.8528 12.93 1486.7 | N = 80 between | 265.7954 42.8915 608.02 | n = 4 within | 165.786 -59.40462 1169.595 | T = 20 | | x2 overall | 2229.428 1429.965 191.5 6241.7 | N = 80 between | 1527.907 671.36 4333.35 | n = 4 within | 521.3062 688.2774 4137.778 | T = 20 | | x3 overall | 358.51 398.2685 .8 2226.3 | N = 80 between | 233.5919 85.64 648.435 | n = 4 within | 342.3096 -287.125 1936.375 | T = 20
0 50 0 10 00 15 00 0 50 0 10 00 15 00 1935 1940 1945 1950 19551935 1940 1945 1950 1955 GE GM US WEST Y Time Graphs by Id
xtline y
• xtline y, overlay
0 5 0 0 1 0 0 0 1 5 0 0 Y 1935 1940 1945 1950 1955 Time GE GM US WESTI.1. Kuadrat Terkecil
(Pooled Least Square)
. reg y x2 x3
Source | SS df MS Number of obs = 80 ---+--- F( 2, 77) = 119.63 Model | 4849457.37 2 2424728.69 Prob > F = 0.0000 Residual | 1560689.67 77 20268.697 R-squared = 0.7565 ---+--- Adj R-squared = 0.7502 Total | 6410147.04 79 81141.1018 Root MSE = 142.37
--- y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- x2 | .1100955 .0137297 8.02 0.000 .0827563 .1374348 x3 | .3033932 .0492957 6.15 0.000 .2052328 .4015535 _cons | -63.30413 29.6142 -2.14 0.036 -122.2735 -4.334734 ---
I. 2. Efek Tetap (Fixed Effect)
. xtreg y x2 x3, fe
Fixed-effects (within) regression Number of obs = 80 Group variable: individu Number of groups = 4 R-sq: within = 0.8068 Obs per group: min = 20 between = 0.7304 avg = 20.0 overall = 0.7554 max = 20 F(2,74) = 154.53 corr(u_i, Xb) = -0.1001 Prob > F = 0.0000 --- y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- x2 | .1079481 .0175089 6.17 0.000 .0730608 .1428354 x3 | .3461617 .0266645 12.98 0.000 .2930315 .3992918 _cons | -73.84946 37.52291 -1.97 0.053 -148.6155 .9165759 ---+--- sigma_u | 139.05116 sigma_e | 75.288894
rho | .77329633 (fraction of variance due to u_i)
--- F test that all u_i=0: F(3, 74) = 67.11 Prob > F = 0.0000
I. 2. Efek Tetap (Fixed Effect)
Menggunakan Pendekatan Least Square Dummy Variable (LSDV)
. reg y x2 x3 i.id
Source | SS df MS Number of obs = 80 ---+--- F( 5, 74) = 211.37 Model | 5990684.14 5 1198136.83 Prob > F = 0.0000 Residual | 419462.898 74 5668.41754 R-squared = 0.9346 ---+--- Adj R-squared = 0.9301 Total | 6410147.04 79 81141.1018 Root MSE = 75.289 --- y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- x2 | .1079481 .0175089 6.17 0.000 .0730608 .1428354 x3 | .3461617 .0266645 12.98 0.000 .2930315 .3992918 | id | 2 | 161.5722 46.45639 3.48 0.001 69.00583 254.1386 3 | 339.6328 23.98633 14.16 0.000 291.839 387.4266 4 | 186.5665 31.50681 5.92 0.000 123.7879 249.3452 | _cons | -245.7924 35.81112 -6.86 0.000 -317.1476 -174.4371 ---
I. 3. Efek Acak (Random Effect)
. xtreg y x2 x3
Random-effects GLS regression Number of obs = 80 Group variable: individu Number of groups = 4 R-sq: within = 0.8068 Obs per group: min = 20 between = 0.7303 avg = 20.0 overall = 0.7554 max = 20 Random effects u_i ~ Gaussian Wald chi2(2) = 317.79 corr(u_i, X) = 0 (assumed) Prob > chi2 = 0.0000 --- y | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---+--- x2 | .1076555 .0168169 6.40 0.000 .0746949 .140616 x3 | .3457104 .0265451 13.02 0.000 .2936829 .3977378 _cons | -73.03529 83.94957 -0.87 0.384 -237.5734 91.50284 ---+--- sigma_u | 152.15823 sigma_e | 75.288894
rho | .80332024 (fraction of variance due to u_i)
Ringkasan: FE, RE, dan OLS
Untuk membandingkan ketiganya, terlebih dulu menyimpan hasil regresi
masing-masing metode dengan command : estimates store (nama)
. estimates store fe . estimates store re . estimates store ols
. estimates table fe re ols, star stats(N r2 r2_a)
--- Variable | fe re ols ---+--- x2 | .10794807*** .10765546*** .11009554*** x3 | .34616168*** .34571038*** .30339316*** _cons | -73.849456 -73.035291 -63.304134* ---+--- N | 80 80 80 r2 | .80681613 .75652826 r2_a | .79376317 .75020432 --- legend: * p<0.05; ** p<0.01; *** p<0.001
II. Pemilihan Metode Estimasi
dalam Panel Data
II. 1. Pooled Least Square VS Fixed
Effect: Restricted F-test
. xtreg y x2 x3, fe
Fixed-effects (within) regression Number of obs = 80 Group variable: individu Number of groups = 4
R-sq: within = 0.8068 Obs per group: min = 20 between = 0.7304 avg = 20.0 overall = 0.7554 max = 20
F(2,74) = 154.53 corr(u_i, Xb) = -0.1001 Prob > F = 0.0000
--- y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- x2 | .1079481 .0175089 6.17 0.000 .0730608 .1428354 x3 | .3461617 .0266645 12.98 0.000 .2930315 .3992918 _cons | -73.84946 37.52291 -1.97 0.053 -148.6155 .9165759 ---+--- sigma_u | 139.05116 sigma_e | 75.288894
rho | .77329633 (fraction of variance due to u_i)
--- F test that all u_i=0: F(3, 74) = 67.11 Prob > F = 0.0000
II. 2. Fixed Effect VS Random
Effect
Kriteria
FE
RE
Functional
form
Intersep
Bervariasi
dan/atau waktu
antar
individu
Konstan
Error variance
Konstan
Bervarisasi antar individu
atau waktu
Slopes
Konstan
Konstan
Estimation
LSDV, within effect method
GLS, FGLS
II. 2. Fixed Effect VS Random
Effect: Hausman test
. quietly xtreg y x2 x3, fe . estimates store fe . quietly xtreg y x2 x3, re . estimates store re . hausman fe re ---- Coefficients ---- | (b) (B) (b-B) sqrt(diag(V_b-V_B)) | fe re Difference S.E. ---+--- x2 | .1079481 .1076555 .0002926 .0048738 x3 | .3461617 .3457104 .0004513 .0025204 --- b = consistent under Ho and Ha; obtained from xtreg B = inconsistent under Ha, efficient under Ho; obtained from xtreg Test: Ho: difference in coefficients not systematic
chi2(2) = (b-B)'[(V_b-V_B)^(-1)](b-B) = 0.07
II. 3. Pooled Least Square VS
Random Effect
Lakukan pengujian LM test tepat setelah melakukan estimasi dengan REM
. xtreg y x2 x3, re . xttest0
Breusch and Pagan Lagrangian multiplier test for random effects y[individu,t] = Xb + u[individu] + e[individu,t]
Estimated results: | Var sd = sqrt(Var) ---+--- y | 81141.1 284.8528 e | 5668.418 75.28889 u | 23152.13 152.1582 Test: Var(u) = 0 chi2(1) = 379.08 Prob > chi2 = 0.0000
III. Teori Evaluasi Hasil Regresi
•
Mengapa penting???
–
Agar koefisien yang didapatkan efisien serta unbiased.
•
Oleh karena itu kriteria teori, kriteria statistik, dan kriteria
ekonometrika harus dilakukan.
•
Menurut Baltagi (1981), dasar pembentukkan model panel masih
menggunakan Least Square. Oleh karena itu, dalam mengevaluasi hasil
model persamaan simultan-panel dapat dilakukan melalui pendekatan
Least Square.
•
Khusus Random Effects Model (REM) metode yang dipakai adalah GLS
regression. Jadi tidak perlu lagi untuk melakukan pengujian
Heteroskedastisitas dan Autokolerasi
III.1. Kriteria Ekonomi atau Teori
Dapat dilihat dari beberapa indikator:
–
Slope
–Arah
–Signifikansi
Apakah sudah sesuai dengan teori?
Tidak? ada kemungkinan data, variabel, dan spesifikasi model
yang digunakan dalam regresi salah.
III.2. Kriteria Statistik
A. Uji signifikansi serentak (F-Test)
•
Uji ini untuk melihat secara global, apakah
semua variable independent secara
bersama-sama mempengaruhi variable dependent.
•
Hipotesis:
H
0
: β0 = β1 = β2 = β3 = β4 = ….. = βk = 0
H
1
: β0 ≠ β1 ≠ β2 ≠ β3 ≠ β4 ≠ ….. = βk ≠ 0
•
Hipotesis nol akan ditolak jika nilai
F-statistik > nilai F tabel atau bila (Prob > F) <α.
Jika nilai dari (Prob > F) = 0 berarti (Prob > F)
<α (0.05),
III.2. Kriteria Statistik
B. Uji Signifikansi Parsial (t-test).
•
Uji ini untuk melihat secara parsial atau
pervariabel,
apakah
masing-masing
independent
variable
secara
signifikan
berpengaruh terhadap dependent variable.
•
Hipotesis:
H
0
: βk = 0
H
1
: βk ≠ 0
•
Hipotesis nol akan ditolak bila (P>|t|)<α
atau nilai t-stat > nilai kritis t-tabel.
III.2. Kriteria Statistik
C. Uji Goodness of Fit.
•
Untuk mengukur seberapa besar variasi
dari nilai variabel dependen dapat
dijelaskan oleh variasi nilai dari variabel
independen.
•
Caranya? Lihat R-squared dari hasil regresi
III.2. Kriteria Statistik
. xtreg y x2 x3, fe
Fixed-effects (within) regression Number of obs = 80 Group variable: individu Number of groups = 4 R-sq: within = 0.8068 Obs per group: min = 20 between = 0.7304 avg = 20.0 overall = 0.7554 max = 20 F(2,74) = 154.53 corr(u_i, Xb) = -0.1001 Prob > F = 0.0000 --- y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- x2 | .1079481 .0175089 6.17 0.000 .0730608 .1428354 x3 | .3461617 .0266645 12.98 0.000 .2930315 .3992918 _cons | -73.84946 37.52291 -1.97 0.053 -148.6155 .9165759 ---+--- sigma_u | 139.05116 sigma_e | 75.288894
rho | .77329633 (fraction of variance due to u_i)
--- F test that all u_i=0: F(3, 74) = 67.11 Prob > F = 0.0000
Uji Goodness of Fit Uji Parsial (t-test) Uji Global ( F-test) Kriteria Ekonomi
III.3. Kriteria Ekonometrika
1. Bebas dari Multikolinearitas
corr y x2 x3
(obs=80)
| y x2 x3
---+---
y | 1.0000
x2 | 0.7980 1.0000
x3 | 0.7438 0.5783 1.0000
Diindikasikan multikolinearitas tinggi jika nilainya lebih dari
0.75
III.3. Kriteria Ekonometrika
1. Bebas dari Multikolinearitas
VIF dilakukan setelah melakukan regresi dengan PLS
. reg y x2 x3
. vif
Variable | VIF 1/VIF
---+---
x2 | 1.50 0.665623
x3 | 1.50 0.665623
---+---
Mean VIF | 1.50
III.3. Kriteria Ekonometrika
1. Bebas dari Multikolinearitas
VIF dilakukan setelah melakukan regresi dengan FE atau RE
. xreg y x2 x3, fe
. vif, uncentered
Variable | VIF 1/VIF
---+---
x2 | 2.74 0.365614
x3 | 2.74 0.365614
---+---
Mean VIF | 2.74
III.3. Kriteria Ekonometrika
2. Bebas dari Heteroskedastisitas
•
Uji heterokedastisitas hanya dilakukan
ketika menggunakan estimasi FE dan PLS
•
Hipotesis:
H
0
: Homoskedastis
H
1
: Heteroskedastis
•
Hipotesis nol akan ditolak bila
(Prob>chi2)<α atau nilai chi2> nilai kritis
t-tabel.
III.3. Kriteria Ekonometrika
2. Bebas dari Heteroskedastisitas: PLS
. quietly reg y x2 x3
. hettest
Breusch-Pagan / Cook-Weisberg test for
heteroskedasticity
Ho: Constant variance
Variables: fitted values of y
chi2(1) = 3.08
Prob > chi2 = 0.0794
III.3. Kriteria Ekonometrika
2. Bebas dari Heteroskedastisitas: Fixed Effect
. xtreg y x2 x3, fe
. xttest3
Modified Wald test for groupwise
heteroskedasticity
in fixed effect regression model
H0: sigma(i)^2 = sigma^2 for all i
chi2 (4) = 240.33
III.3. Kriteria Ekonometrika
3. Bebas dari Autokorelasi
•
Uji serial correlation in the idiosyncratic errors of a
linear panel-data model oleh Wooldridge (2002).
•
Hipotesis:
H
0
: No autokorelasi
H
1
: Autokorelasi
•
Hipotesis nol akan ditolak bila (Prob>chi2)<α
III.3. Kriteria Ekonometrika
3. Bebas dari Autokorelasi
. xtreg y x2 x3, fe
. xtserial y x2 x3
Wooldridge test for autocorrelation in
panel data
H0: no first-order autocorrelation
F( 1, 3) = 1300.479
Prob > F = 0.0000
IV.1. Robust Method: PLS
. reg y x2 x3, ro
Linear regression Number of obs = 80 F( 2, 77) = 167.22 Prob > F = 0.0000 R-squared = 0.7565 Root MSE = 142.37 --- | Robust
y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- x2 | .1100955 .0105705 10.42 0.000 .0890469 .1311442 x3 | .3033932 .0606153 5.01 0.000 .1826927 .4240936 _cons | -63.30413 22.90485 -2.76 0.007 -108.9135 -17.69474 ---
IV.1. Robust Method: Fixed Effect
. xtreg y x2 x3, fe ro
Fixed-effects (within) regression Number of obs = 80 Group variable: id Number of groups = 4
R-sq: within = 0.8068 Obs per group: min = 20 between = 0.7304 avg = 20.0 overall = 0.7554 max = 20 F(2,3) = 55.79 corr(u_i, Xb) = -0.1001 Prob > F = 0.0042
(Std. Err. adjusted for 4 clusters in id) --- | Robust
y | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---+--- x2 | .1079481 .0166046 6.50 0.007 .0551049 .1607912 x3 | .3461617 .036063 9.60 0.002 .2313933 .4609301 _cons | -73.84946 48.86551 -1.51 0.228 -229.3613 81.66242 ---+--- sigma_u | 139.05116 sigma_e | 75.288894
rho | .77329633 (fraction of variance due to u_i)
IV.2. General Least Square (GLS)
Method: GLS
. xtgls y x2 x3
Cross-sectional time-series FGLS regression
Coefficients: generalized least squares Panels: homoskedastic
Correlation: no autocorrelation
Estimated covariances = 1 Number of obs = 80 Estimated autocorrelations = 0 Number of groups = 4 Estimated coefficients = 3 Time periods = 20 Wald chi2(2) = 248.58 Log likelihood = -508.6596 Prob > chi2 = 0.0000
--- y | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---+--- x2 | .1100955 .0134698 8.17 0.000 .0836953 .1364958 x3 | .3033932 .0483626 6.27 0.000 .2086042 .3981821 _cons | -63.30413 29.05362 -2.18 0.029 -120.2482 -6.360075 ---
IV.2. General Least Square (GLS)
Method: Fixed Effect
. xtgls y x2 x3 i.id
Cross-sectional time-series FGLS regression
Coefficients: generalized least squares Panels: homoskedastic
Correlation: no autocorrelation
Estimated covariances = 1 Number of obs = 80 Estimated autocorrelations = 0 Number of groups = 4 Estimated coefficients = 6 Time periods = 20 Wald chi2(5) = 1142.54 Log likelihood = -456.1032 Prob > chi2 = 0.0000
--- y | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---+--- x2 | .1079481 .0168395 6.41 0.000 .0749432 .140953 x3 | .3461617 .0256451 13.50 0.000 .2958982 .3964251 | id | 2 | 161.5722 44.68033 3.62 0.000 74.00038 249.144 3 | 339.6328 23.06931 14.72 0.000 294.4178 384.8479 4 | 186.5665 30.30227 6.16 0.000 127.1752 245.9579 | _cons | -245.7924 34.44203 -7.14 0.000 -313.2975 -178.2872 ---