title: “Final Ekonomitrika”Pengolahan Data Panel"" author: “28_Karmelia” date: “6/29/2021” output: html_document —
langkah 1 menginstal packages
library(plm)
library(lmtest)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
langkah 2 membaca data
library(readxl)
Data_Panel_ <- read_excel("C:/Users/ASUS/OneDrive/Documents/Data Panel..xlsx")
View(Data_Panel_)
langkah 3 membuat deskripsi data yang di gunakan
str(Data_Panel_)
## tibble[,5] [21 x 5] (S3: tbl_df/tbl/data.frame)
## $ Kabupaten: chr [1:21] "Karimun" "Karimun" "Karimun" "Bintan" ...
## $ Tahun : num [1:21] 2017 2018 2019 2017 2018 ...
## $ TPT : num [1:21] 5.7 2.45 5.46 8.08 5.89 8.01 4.07 3.52 3.33 3.23 ...
## $ IPM : num [1:21] 70.3 70.6 71.1 72.9 73.4 ...
## $ Miskin : num [1:21] 7.41 6.9 6.61 6.01 6.61 ...
summary(Data_Panel_)
## Kabupaten Tahun TPT IPM
## Length:21 Min. :2017 Min. :2.45 Min. :63.45
## Class :character 1st Qu.:2017 1st Qu.:3.52 1st Qu.:68.48
## Mode :character Median :2018 Median :5.46 Median :72.10
## Mean :2018 Mean :5.27 Mean :72.43
## 3rd Qu.:2019 3rd Qu.:7.11 3rd Qu.:78.00
## Max. :2019 Max. :8.93 Max. :81.09
## Miskin
## Min. : 4.420
## 1st Qu.: 5.110
## Median : 6.610
## Mean : 7.452
## 3rd Qu.: 9.030
## Max. :13.840
names(Data_Panel_)
## [1] "Kabupaten" "Tahun" "TPT" "IPM" "Miskin"
langkah 4 membuat estimasi modal regresi data paneldaei keiga dari ketiga modal yang ada
common=plm(Miskin~TPT+IPM, data = Data_Panel_, model = "pooling")
summary(common)
## Pooling Model
##
## Call:
## plm(formula = Miskin ~ TPT + IPM, data = Data_Panel_, model = "pooling")
##
## Balanced Panel: n = 7, T = 3, N = 21
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -2.82186 -1.79373 -0.65595 3.12820 3.81179
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## (Intercept) 31.62190 9.50892 3.3255 0.003763 **
## TPT 0.25843 0.40258 0.6419 0.529008
## IPM -0.35251 0.15063 -2.3403 0.030985 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 167.15
## Residual Sum of Squares: 116.77
## R-Squared: 0.3014
## Adj. R-Squared: 0.22378
## F-statistic: 3.88288 on 2 and 18 DF, p-value: 0.039634
FE=plm(Miskin~TPT+IPM,data=Data_Panel_,model="within","effect"="time",index=c("Kabupaten","Tahun"))
summary(FE)
## Oneway (time) effect Within Model
##
## Call:
## plm(formula = Miskin ~ TPT + IPM, data = Data_Panel_, effect = "time",
## model = "within", index = c("Kabupaten", "Tahun"))
##
## Balanced Panel: n = 7, T = 3, N = 21
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -2.62656 -1.73223 -0.83193 3.08379 4.00105
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## TPT 0.32993 0.46656 0.7072 0.48964
## IPM -0.37317 0.16926 -2.2047 0.04246 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 166.62
## Residual Sum of Squares: 115.71
## R-Squared: 0.30554
## Adj. R-Squared: 0.13193
## F-statistic: 3.5198 on 2 and 16 DF, p-value: 0.054095
RE=plm(Miskin~TPT+IPM,data=Data_Panel_,model="random",index=c("Kabupaten","Tahun"))
summary(RE)
## Oneway (individual) effect Random Effect Model
## (Swamy-Arora's transformation)
##
## Call:
## plm(formula = Miskin ~ TPT + IPM, data = Data_Panel_, model = "random",
## index = c("Kabupaten", "Tahun"))
##
## Balanced Panel: n = 7, T = 3, N = 21
##
## Effects:
## var std.dev share
## idiosyncratic 0.06287 0.25075 0.007
## individual 9.42078 3.06933 0.993
## theta: 0.9529
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -0.502287 -0.175332 -0.012933 0.195084 0.319201
##
## Coefficients:
## Estimate Std. Error z-value Pr(>|z|)
## (Intercept) 31.491392 7.418959 4.2447 2.189e-05 ***
## TPT -0.032256 0.058122 -0.5550 0.578907
## IPM -0.329564 0.100641 -3.2746 0.001058 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 1.6367
## Residual Sum of Squares: 1.0252
## R-Squared: 0.37365
## Adj. R-Squared: 0.30406
## Chisq: 10.738 on 2 DF, p-value: 0.0046589
langkah 5 menentukan model terbaik yang akan di gunakan
Untuk memperoleh model yang tepat dalam mengestimasi regresi data panel digunakan 2 teknik: Chow test, digunakan untuk memilih antara model Common Effect atau Fixed Effect. Hausman test, digunakan untuk memilih antara model Fixed Effect atau Random Effect
phtest(FE,RE)
##
## Hausman Test
##
## data: Miskin ~ TPT + IPM
## chisq = 3.1248, df = 2, p-value = 0.2096
## alternative hypothesis: one model is inconsistent
Langkah 6: Melakukan Pengujian Breusch-Pangan
Dari uji Hausmann diketahui bahwa data panel menggunakan model efek tetap. Oleh karena itu, dilanjutkan dengan uji Breusch-Pagan untuk mengetahui apakah terdapat efek kali-silang, efek waktu atau efek kali-silang maupun waktu (2 arah). Diperoleh output sebagai berikut;
m=plm(Miskin~TPT+IPM, data = Data_Panel_, model = "within", index = c("Kabupaten","Tahun"))
plmtest(m, effect = "twoways", type = "bp")#uji efek individu maupun waktu
##
## Lagrange Multiplier Test - two-ways effects (Breusch-Pagan) for
## balanced panels
##
## data: Miskin ~ TPT + IPM
## chisq = 21.377, df = 2, p-value = 2.281e-05
## alternative hypothesis: significant effects
plmtest(m,effect = "individual") # uji efek individu
##
## Lagrange Multiplier Test - (Honda) for balanced panels
##
## data: Miskin ~ TPT + IPM
## normal = 4.4506, p-value = 4.281e-06
## alternative hypothesis: significant effects
plmtest(m,effect = "time",type = "bp")#uji efek waktu
##
## Lagrange Multiplier Test - time effects (Breusch-Pagan) for balanced
## panels
##
## data: Miskin ~ TPT + IPM
## chisq = 1.5688, df = 1, p-value = 0.2104
## alternative hypothesis: significant effects
Langkah 6: Pembuatan Model Dari uji hausmann dan uji breusch-pagan disimpukan bahwa model yang akan diestimasi adalah model data efek tetap dengan efek waktu. Kemudian dilakukan uji signifikansi variabel pada model sebagai berikut :
model1=plm(Miskin~TPT+IPM, data = Data_Panel_, model = "within", effect = "time", index = c("Kabupaten","Tahun"))
summary(model1)
## Oneway (time) effect Within Model
##
## Call:
## plm(formula = Miskin ~ TPT + IPM, data = Data_Panel_, effect = "time",
## model = "within", index = c("Kabupaten", "Tahun"))
##
## Balanced Panel: n = 7, T = 3, N = 21
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -2.62656 -1.73223 -0.83193 3.08379 4.00105
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## TPT 0.32993 0.46656 0.7072 0.48964
## IPM -0.37317 0.16926 -2.2047 0.04246 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 166.62
## Residual Sum of Squares: 115.71
## R-Squared: 0.30554
## Adj. R-Squared: 0.13193
## F-statistic: 3.5198 on 2 and 16 DF, p-value: 0.054095
fixef(model1,type="level")
## 2017 2018 2019
## 32.451 33.051 32.722
Langkah 7: Pengujian Diagnostik 1. Uji Korelasi Serial (Uji Multikolineritas)
pbgtest(FE)
##
## Breusch-Godfrey/Wooldridge test for serial correlation in panel models
##
## data: Miskin ~ TPT + IPM
## chisq = 12.865, df = 3, p-value = 0.004939
## alternative hypothesis: serial correlation in idiosyncratic errors
Uji hipotesis korelasi serial • Hipotesis H0 : tidak ada korelasi serial pada komponen galat H1 : ada korelasi serial pada komponen galat • Tingkat signifikansi α = 0,05 • Statistik uji P-value tercantum pada tabel dibawah. • Daerah kritik H0 ditolak jika P-value < α Berdasarkan perhitungan di atas p value di peroleh 0.004, di mana lebih kecil dari 0.05 terdapat korelasi serial
bptest(FE)
##
## studentized Breusch-Pagan test
##
## data: FE
## BP = 1.8164, df = 2, p-value = 0.4033
Uji Heteroskedasitas • Hipotesis H0 : heteroskedasitas H1 : heteroskedastisitas • Tingkat signifikansi α = 0,05 • Statistik uji P-value tercantum pada tabel dibawah. • Daerah kritik H0 ditolak jika P-value < α • Kesimpulan: diperoleh nilai BP sebesar 0.4033 lebih besar dari 0.05 , hal ini berarti bahwa tidak terdapat heteroskedasitas