Sei sulla pagina 1di 36

# akbarsuwardi.blogspot.com || scribd.

com/akbar_suwardi

## APLIKASI DATA PANEL

DI STATA

Oleh :

Akbar Suwardi
Dipresentasikan dalam Pelatihan Stata di Dept. Ilmu Ekonomi Universitas Indonesia (2012)

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

Outline

I.

## Pengenalan Data Panel

1.
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
II. General Least Square (GLS) Method: PLS & FE
2

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

Gunakan data

mengenai

## Lakukan Set Panel Data

Xtset individu time, year
Panel variable: individu (strongly balanced)
Time variable: time, 1935 to 1954
Delta: 1 year

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## I. Pengenalan Data Panel

GE

GM

US

WEST

500

1000 1500

500

1000 1500

xtline y

1935

1940

1945

1950

19551935

1940

1945

1950

1955

Time
Graphs by Id

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## I. Pengenalan Data Panel

500

1000

1500

xtline y, overlay

1935

1940

1945
Time
GE
US

1950

1955

GM
WEST

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

(Pooled Least Square)
. reg

y x2 x3

Source |
SS
df
MS
-------------+-----------------------------Model | 4849457.37
2 2424728.69
Residual | 1560689.67
77
20268.697
-------------+-----------------------------Total | 6410147.04
79 81141.1018

Number of obs
F( 2,
77)
Prob > F
R-squared
Root MSE

=
=
=
=
=
=

80
119.63
0.0000
0.7565
0.7502
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
------------------------------------------------------------------------------

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

. xtreg

y x2 x3, fe

## Fixed-effects (within) regression

Group variable: individu

Number of obs
Number of groups

=
=

80
4

R-sq:

## Obs per group: min =

avg =
max =

20
20.0
20

within = 0.8068
between = 0.7304
overall = 0.7554

corr(u_i, Xb)

= -0.1001

F(2,74)
Prob > F

=
=

154.53
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
8

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## I. 2. Efek Tetap (Fixed Effect)

Menggunakan Pendekatan Least Square Dummy Variable (LSDV)
. reg y x2 x3 i.id
Source |
SS
df
MS
-------------+-----------------------------Model | 5990684.14
5 1198136.83
Residual | 419462.898
74 5668.41754
-------------+-----------------------------Total | 6410147.04
79 81141.1018

Number of obs
F( 5,
74)
Prob > F
R-squared
Root MSE

=
=
=
=
=
=

80
211.37
0.0000
0.9346
0.9301
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
------------------------------------------------------------------------------

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

. xtreg

y x2 x3

## Random-effects GLS regression

Group variable: individu

Number of obs
Number of groups

=
=

80
4

R-sq:

avg =
max =

20
20.0
20

within = 0.8068
between = 0.7303
overall = 0.7554

## Random effects u_i ~ Gaussian

corr(u_i, X)
= 0 (assumed)

Wald chi2(2)
Prob > chi2

=
=

317.79
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)
-----------------------------------------------------------------------------10

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## Ringkasan: FE, RE, dan OLS

Untuk membandingkan ketiganya, terlebih dulu menyimpan hasil regresi
masing-masing metode dengan command : estimates store (nama)
.
.
.
.

estimates
estimates
estimates
estimates

store
store
store
table

fe
re
ols
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

11

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## II. Pemilihan Metode Estimasi

dalam Panel Data

12

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## II. 1. Pooled Least Square VS Fixed

Effect: Restricted F-test
. xtreg

y x2 x3, fe

## Fixed-effects (within) regression

Group variable: individu

Number of obs
Number of groups

=
=

80
4

R-sq:

## Obs per group: min =

avg =
max =

20
20.0
20

within = 0.8068
between = 0.7304
overall = 0.7554

corr(u_i, Xb)

= -0.1001

F(2,74)
Prob > F

=
=

154.53
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

13

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

Effect
Kriteria

FE

RE

Functional
form
Intersep

Bervariasi antar
dan/atau waktu

Error variance

Konstan

atau waktu

Slopes

Konstan

Konstan

Estimation

GLS, FGLS

## Hypothesis test Incremental F test

individu

Konstan

BG LM test
14

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## II. 2. Fixed Effect VS Random

Effect: Hausman test
.
.
.
.
.

quietly xtreg y
estimates store
quietly xtreg y
estimates store
hausman fe re

x2 x3, fe
fe
x2 x3, re
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
Prob>chi2 =
0.9678
15

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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) =
Prob > chi2 =

379.08
0.0000

16

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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
17

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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.

18

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## III.2. Kriteria Statistik

A. Uji signifikansi serentak (F-Test)
Uji ini untuk melihat secara global, apakah
semua variable independent secara bersamasama mempengaruhi variable dependent.
Hipotesis:
H0 : 0 = 1 = 2 = 3 = 4 = .. = k = 0
H1 : 0 1 2 3 4 .. = k 0

Hipotesis nol akan ditolak jika nilai Fstatistik > nilai F tabel atau bila (Prob > F) <.
Jika nilai dari (Prob > F) = 0 berarti (Prob > F)
< (0.05),
19

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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
Hipotesis:
H0 : k = 0
H1 : k 0

## Hipotesis nol akan ditolak bila (P>|t|)<

atau nilai t-stat > nilai kritis t-tabel.
20

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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
estimasi.

21

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

. xtreg

y x2 x3, fe

## Fixed-effects (within) regression

Group variable: individu
R-sq:

within = 0.8068
between = 0.7304
overall = 0.7554

corr(u_i, Xb)

= -0.1001

Number of obs
Number of groups
Uji
Goodness
of Fit
Uji
Global
( F-test)

=
=

80
4

## Obs per group: min =

avg =
max =

20
20.0
20

F(2,74)
Prob > F

=
=

154.53
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
-------------+---------------------------------------------------------------Kriteria
sigma_u | 139.05116
Uji
Ekonomi
Parsial
sigma_e | 75.288894
(t-test)
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
22

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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
23

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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
Diindikasikan multikolinearitas tinggi jika nilai VIF lebih dari 10
24

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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
Diindikasikan multikolinearitas tinggi jika nilai VIF lebih dari 10
25

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## III.3. Kriteria Ekonometrika

2. Bebas dari Heteroskedastisitas
Uji heterokedastisitas hanya dilakukan
ketika menggunakan estimasi FE dan PLS
Hipotesis:
H0 : Homoskedastis
H1 : Heteroskedastis

Hipotesis
nol akan ditolak bila
(Prob>chi2)< atau nilai chi2> nilai kritis
t-tabel.
26

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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)
Prob > chi2

=
=

3.08
0.0794

27

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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) =
Prob>chi2 =

240.33
0.0000
28

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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:
H0 : No autokorelasi
H1 : Autokorelasi
Hipotesis nol akan ditolak bila (Prob>chi2)<
atau nilai chi2> nilai kritis t-tabel.
29

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## 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
30

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## IV.1. Robust Method: PLS

. reg y x2 x3, ro

Linear regression

Number of obs =
F( 2,
77) =
Prob > F
=
R-squared
=
Root MSE
=

80
167.22
0.0000
0.7565
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
------------------------------------------------------------------------------

31

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## IV.1. Robust Method: Fixed Effect

. xtreg y x2 x3, fe ro
Fixed-effects (within) regression
Group variable: id

Number of obs
Number of groups

=
=

80
4

R-sq:

avg =
max =

20
20.0
20

within = 0.8068
between = 0.7304
overall = 0.7554

corr(u_i, Xb)

= -0.1001

F(2,3)
Prob > F

=
=

55.79
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)
-----------------------------------------------------------------------------32

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## IV.2. General Least Square (GLS)

Method: GLS
. xtgls y x2 x3
Cross-sectional time-series FGLS regression
Coefficients:
Panels:
Correlation:

## generalized least squares

homoskedastic
no autocorrelation

Estimated covariances
=
Estimated autocorrelations =
Estimated coefficients
=
Log likelihood

1
0
3

= -508.6596

Number of obs
Number of groups
Time periods
Wald chi2(2)
Prob > chi2

=
=
=
=
=

80
4
20
248.58
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
-----------------------------------------------------------------------------33

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

## IV.2. General Least Square (GLS)

Method: Fixed Effect
. xtgls

y x2 x3 i.id

Coefficients:
Panels:
Correlation:

## generalized least squares

homoskedastic
no autocorrelation

Estimated covariances
=
Estimated autocorrelations =
Estimated coefficients
=
Log likelihood

1
0
6

= -456.1032

Number of obs
Number of groups
Time periods
Wald chi2(5)
Prob > chi2

=
=
=
=
=

80
4
20
1142.54
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
-----------------------------------------------------------------------------34

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

Reference
Gujarati, Damodar. 2006. Basic Econometrics. McGrawHill.
Manual Stata. 2011
Suwardi, Akbar. 2011. MODUL STATA: Tahapan dan
Perintah (Syntax) Mengolah Data Panel. Computing
Laboratory of Economics Department - University of
Indonesia. Depok

35

akbarsuwardi.blogspot.com || scribd.com/akbar_suwardi

Terimakasih!

akbarsuwardi@gmail.com
akbarsuwardi.blogspot.com
scribd.com/akbar_suwardi

36