MODEL REGRESI PANEL (Provinsi Banten)

KASUS PERTAMA 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_Nisa <- read_excel("C:/Users/ASUS/Downloads/Data Panel Nisa.xlsx")
View(Data_Panel_Nisa)

LANGKAH 3 MEMBUAT DESKRIPSI DATA YANG DIGUNAKAN

str(Data_Panel_Nisa)
## tibble[,5] [24 x 5] (S3: tbl_df/tbl/data.frame)
##  $ Kabupaten: chr [1:24] "Lebak" "Lebak" "Lebak" "Tangerang" ...
##  $ Tahun    : num [1:24] 2018 2019 2020 2018 2019 ...
##  $ TPT      : num [1:24] 7.57 7.96 13.06 9.63 8.92 ...
##  $ IPM      : num [1:24] 63.4 63.9 63.9 71.6 71.9 ...
##  $ Miskin   : num [1:24] 8.41 8.3 9.24 5.18 5.14 6.23 4.3 4.08 4.94 9.36 ...
summary(Data_Panel_Nisa)
##   Kabupaten             Tahun           TPT              IPM       
##  Length:24          Min.   :2018   Min.   : 4.670   Min.   :63.37  
##  Class :character   1st Qu.:2018   1st Qu.: 8.043   1st Qu.:65.70  
##  Mode  :character   Median :2019   Median : 8.555   Median :71.92  
##                     Mean   :2019   Mean   : 8.913   Mean   :71.38  
##                     3rd Qu.:2020   3rd Qu.: 9.352   3rd Qu.:74.27  
##                     Max.   :2020   Max.   :13.060   Max.   :81.48  
##      Miskin      
##  Min.   : 1.680  
##  1st Qu.: 3.973  
##  Median : 5.160  
##  Mean   : 7.476  
##  3rd Qu.: 8.328  
##  Max.   :53.360
names(Data_Panel_Nisa)
## [1] "Kabupaten" "Tahun"     "TPT"       "IPM"       "Miskin"

LANGKAH 4 MEMBUAT ESTIMASI MODEL REGRESI DATA PANEL DARI KETIGA MODEL YANG ADA

  1. Pooled Lest Square (Common Effect)
CEM=plm(Miskin~TPT+IPM, data = Data_Panel_Nisa, model = "pooling")
summary(CEM)
## Pooling Model
## 
## Call:
## plm(formula = Miskin ~ TPT + IPM, data = Data_Panel_Nisa, model = "pooling")
## 
## Balanced Panel: n = 8, T = 3, N = 24
## 
## Residuals:
##    Min. 1st Qu.  Median 3rd Qu.    Max. 
## -4.4669 -3.1808 -1.9089 -1.0022 45.4718 
## 
## Coefficients:
##             Estimate Std. Error t-value Pr(>|t|)
## (Intercept) 44.59451   37.11216  1.2016   0.2429
## TPT         -0.66756    1.17276 -0.5692   0.5752
## IPM         -0.43665    0.42491 -1.0276   0.3158
## 
## Total Sum of Squares:    2336.6
## Residual Sum of Squares: 2224.7
## R-Squared:      0.047889
## Adj. R-Squared: -0.042788
## F-statistic: 0.528126 on 2 and 21 DF, p-value: 0.59734
  1. Model Fixed Effect
FE=plm(Miskin~TPT+IPM,data = Data_Panel_Nisa,model ="within","effect"="time",index =c("Kabupaten","Tahun"))
summary(FE)
## Oneway (time) effect Within Model
## 
## Call:
## plm(formula = Miskin ~ TPT + IPM, data = Data_Panel_Nisa, effect = "time", 
##     model = "within", index = c("Kabupaten", "Tahun"))
## 
## Balanced Panel: n = 8, T = 3, N = 24
## 
## Residuals:
##     Min.  1st Qu.   Median  3rd Qu.     Max. 
## -7.80423 -4.47520 -1.04111  0.76949 42.11483 
## 
## Coefficients:
##     Estimate Std. Error t-value Pr(>|t|)
## TPT -0.64070    1.43711 -0.4458   0.6608
## IPM -0.41713    0.46159 -0.9037   0.3775
## 
## Total Sum of Squares:    2160.1
## Residual Sum of Squares: 2068.9
## R-Squared:      0.042235
## Adj. R-Squared: -0.1594
## F-statistic: 0.418921 on 2 and 19 DF, p-value: 0.66369
  1. Model Random Effect
RE=plm(Miskin~TPT+IPM,data = Data_Panel_Nisa,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_Nisa, model = "random", 
##     index = c("Kabupaten", "Tahun"))
## 
## Balanced Panel: n = 8, T = 3, N = 24
## 
## Effects:
##                  var std.dev share
## idiosyncratic 96.980   9.848  0.89
## individual    11.966   3.459  0.11
## theta: 0.1457
## 
## Residuals:
##     Min.  1st Qu.   Median  3rd Qu.     Max. 
## -4.38963 -3.10834 -2.07065 -0.76841 43.53108 
## 
## Coefficients:
##             Estimate Std. Error z-value Pr(>|z|)
## (Intercept) 42.20102   39.57167  1.0664   0.2862
## TPT         -0.54615    1.19398 -0.4574   0.6474
## IPM         -0.41828    0.46301 -0.9034   0.3663
## 
## Total Sum of Squares:    2115.8
## Residual Sum of Squares: 2036.6
## R-Squared:      0.03741
## Adj. R-Squared: -0.054266
## Chisq: 0.816136 on 2 DF, p-value: 0.66493

LANGKAH 5 MENENTUKAN MODEL TERBAIK YANG AKAN DIGUNAKAN

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 = 0.00097874, df = 2, p-value = 0.9995
## alternative hypothesis: one model is inconsistent
phtest(FE,RE)
## 
##  Hausman Test
## 
## data:  Miskin ~ TPT + IPM
## chisq = 0.00097874, df = 2, p-value = 0.9995
## 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_Nisa, 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 = 0.35848, df = 2, p-value = 0.8359
## alternative hypothesis: significant effects
plmtest(m,effect = "individual") # uji efek individu 
## 
##  Lagrange Multiplier Test - (Honda) for balanced panels
## 
## data:  Miskin ~ TPT + IPM
## normal = -0.1619, p-value = 0.5643
## 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 = 0.33227, df = 1, p-value = 0.5643
## alternative hypothesis: significant effects

Uji di atas digunakan untuk menentukan apakah ada efek time maupun individu atau bahkan tidak ada pada model. Ketika nilai p-value kurang dari alpha maka dapat disimpulkan ada efek. Dari output di atas diperoleh bahwa pada model hanya terdapat efek waktu sehingga model yang dibentuk pun memiliki efek waktu.

LANGKAH 7 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_Nisa, model = "within", effect = "time", index = c("Kabupaten","Tahun"))
summary(model1)
## Oneway (time) effect Within Model
## 
## Call:
## plm(formula = Miskin ~ TPT + IPM, data = Data_Panel_Nisa, effect = "time", 
##     model = "within", index = c("Kabupaten", "Tahun"))
## 
## Balanced Panel: n = 8, T = 3, N = 24
## 
## Residuals:
##     Min.  1st Qu.   Median  3rd Qu.     Max. 
## -7.80423 -4.47520 -1.04111  0.76949 42.11483 
## 
## Coefficients:
##     Estimate Std. Error t-value Pr(>|t|)
## TPT -0.64070    1.43711 -0.4458   0.6608
## IPM -0.41713    0.46159 -0.9037   0.3775
## 
## Total Sum of Squares:    2160.1
## Residual Sum of Squares: 2068.9
## R-Squared:      0.042235
## Adj. R-Squared: -0.1594
## F-statistic: 0.418921 on 2 and 19 DF, p-value: 0.66369
fixef(model1,type="level")
##   2018   2019   2020 
## 46.335 40.169 42.381

Langkah 7 PENGUJIAN DIAGNOSISTIK

  1. Uji Korelasi Serial (Uji Multikolineritas)
pbgtest(FE)
## 
##  Breusch-Godfrey/Wooldridge test for serial correlation in panel models
## 
## data:  Miskin ~ TPT + IPM
## chisq = 0.76754, df = 3, p-value = 0.8572
## alternative hypothesis: serial correlation in idiosyncratic errors

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.8572 di mana lebih kecil dari 0.05 terdapat korelasi serial

  1. Uji Heteroskedasitas
bptest(FE)
## 
##  studentized Breusch-Pagan test
## 
## data:  FE
## BP = 0.2077, df = 2, p-value = 0.9014