Pemodelan Regresi Data Panel terhadap Faktor-Faktor yang
Mempengaruhi Tingkat Pengangguran Terbuka di Kab/Kota Provinsi Sumatera
Barat Tahun 2018-2023
Data
library(readxl)
Data_Projek_ADP <- read_excel("D:/Download/Data Projek ADP.xlsx")
Data_Projek_ADP$Tahun<-as.factor(Data_Projek_ADP$Tahun)
Data_Projek_ADP$`Kabupaten/Kota`<-as.factor(Data_Projek_ADP$`Kabupaten/Kota`)
Data_Projek_ADP$Y<-Data_Projek_ADP$TPT
Data_Projek_ADP$X1<-Data_Projek_ADP$IPM
Data_Projek_ADP$X2<-Data_Projek_ADP$PDRB
Data_Projek_ADP$X3<-Data_Projek_ADP$`Gini Ratio`
Data_Projek_ADP<-Data_Projek_ADP[,-c(3:6)]
Eksplorasi Data
library(psych)
## Warning: package 'psych' was built under R version 4.3.3
YTahun <- describeBy(Data_Projek_ADP$Y, group = Data_Projek_ADP$Tahun)
YTahun
##
## Descriptive statistics by group
## group: 2018
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 19 5.22 1.74 5.82 5.16 1.79 2.31 9.29 6.98 0.24 -0.44 0.4
## ------------------------------------------------------------
## group: 2019
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 19 5.08 1.55 4.91 5.03 1.65 2.3 8.74 6.44 0.33 -0.23 0.36
## ------------------------------------------------------------
## group: 2020
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 19 6.29 2.34 5.62 6.05 1.57 3.03 13.64 10.61 1.45 2.48 0.54
## ------------------------------------------------------------
## group: 2021
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 19 5.56 2.33 5.02 5.29 1.41 2.25 13.37 11.12 1.8 4.09 0.54
## ------------------------------------------------------------
## group: 2022
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 19 5.28 1.95 5 5.13 1.32 1.39 11.69 10.3 1.41 4.01 0.45
## ------------------------------------------------------------
## group: 2023
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 19 5.11 1.86 4.99 5 0.74 1.33 10.86 9.53 0.98 2.88 0.43
YKabKota <- describeBy(Data_Projek_ADP$Y, group = Data_Projek_ADP$`Kabupaten/Kota`)
YKabKota
##
## Descriptive statistics by group
## group: Kab Agam
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 4.88 0.16 4.93 4.88 0.12 4.61 5.06 0.45 -0.56 -1.33 0.06
## ------------------------------------------------------------
## group: Kab Dharmasraya
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.31 0.84 5.18 5.31 0.9 4.02 6.23 2.21 -0.18 -1.58 0.34
## ------------------------------------------------------------
## group: Kab Kepulauan Mentawai
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 2.45 1.01 2.55 2.45 1.13 1.33 3.98 2.65 0.18 -1.65 0.41
## ------------------------------------------------------------
## group: Kab Lima Puluh Kota
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 3 0.71 2.88 3 0.9 2.25 3.95 1.7 0.22 -1.94 0.29
## ------------------------------------------------------------
## group: Kab Padang Pariaman
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 7.16 0.92 6.86 7.16 0.77 6.08 8.41 2.33 0.29 -1.87 0.38
## ------------------------------------------------------------
## group: Kab Pasaman
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.29 0.4 5.19 5.29 0.25 4.92 6.04 1.12 0.88 -0.85 0.16
## ------------------------------------------------------------
## group: Kab Pasaman Barat
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.03 1.06 4.88 5.03 0.98 3.36 6.33 2.97 -0.21 -1.49 0.43
## ------------------------------------------------------------
## group: Kab Pesisir Selatan
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.73 0.9 5.99 5.73 0.77 4.61 7 2.39 -0.05 -1.71 0.37
## ------------------------------------------------------------
## group: Kab Sijunjung
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 4.22 0.85 4.18 4.22 0.96 3.22 5.3 2.08 0.05 -2.06 0.35
## ------------------------------------------------------------
## group: Kab Solok
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.17 0.66 4.86 5.17 0.29 4.65 6.12 1.47 0.49 -1.9 0.27
## ------------------------------------------------------------
## group: Kab Solok Selatan
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 4.58 1.24 4.88 4.58 1.27 2.57 5.84 3.27 -0.5 -1.53 0.5
## ------------------------------------------------------------
## group: Kab Tanah Datar
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 4.65 0.96 4.71 4.65 0.99 3.2 5.91 2.71 -0.18 -1.56 0.39
## ------------------------------------------------------------
## group: Kota Bukittinggi
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 6.16 1.09 6.14 6.16 1.67 4.9 7.51 2.61 0.03 -1.93 0.45
## ------------------------------------------------------------
## group: Kota Padang
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 11.27 2.03 11.27 11.27 3.02 8.74 13.64 4.9 -0.02 -1.96 0.83
## ------------------------------------------------------------
## group: Kota Padang Panjang
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.36 0.99 5.12 5.36 0.48 4.38 7.22 2.84 0.89 -0.77 0.4
## ------------------------------------------------------------
## group: Kota Pariaman
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.66 0.31 5.7 5.66 0.25 5.19 6.09 0.9 -0.19 -1.38 0.13
## ------------------------------------------------------------
## group: Kota Payakumbuh
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.2 1.15 5 5.2 1.42 3.95 6.68 2.73 0.21 -1.95 0.47
## ------------------------------------------------------------
## group: Kota Sawahlunto
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 6.22 1.22 6.15 6.22 1.36 4.98 8.2 3.22 0.39 -1.49 0.5
## ------------------------------------------------------------
## group: Kota Solok
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 6 5.7 1.81 5.59 5.7 2.34 3.72 8.35 4.63 0.2 -1.79 0.74
Grafik Pergerakan Y (Tingkat Pengangguran Terbuka)
library(plotly)
## Warning: package 'plotly' was built under R version 4.3.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 4.3.3
##
## Attaching package: 'ggplot2'
## The following objects are masked from 'package:psych':
##
## %+%, alpha
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
plot_ly(Data_Projek_ADP, x = Data_Projek_ADP$Tahun, y = Data_Projek_ADP$Y,
type = 'scatter', mode = 'lines+markers',
color = Data_Projek_ADP$`Kabupaten/Kota`)
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors
## Warning in RColorBrewer::brewer.pal(N, "Set2"): n too large, allowed maximum for palette Set2 is 8
## Returning the palette you asked for with that many colors
Pendugaan Parameter
library(plm)
## Warning: package 'plm' was built under R version 4.3.3
common<-plm(Y~X1+X2+X3, data = Data_Projek_ADP, model = "pooling")
summary(common)
## Pooling Model
##
## Call:
## plm(formula = Y ~ X1 + X2 + X3, data = Data_Projek_ADP, model = "pooling")
##
## Balanced Panel: n = 6, T = 19, N = 114
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -2.524560 -0.983069 -0.053537 0.756945 3.201944
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## (Intercept) -8.9745e+00 1.8934e+00 -4.7400 6.440e-06 ***
## X1 1.3145e-01 2.6311e-02 4.9961 2.219e-06 ***
## X2 7.2389e-05 9.1886e-06 7.8782 2.561e-12 ***
## X3 1.3282e+01 4.0064e+00 3.3151 0.001241 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 446.16
## Residual Sum of Squares: 178.65
## R-Squared: 0.59958
## Adj. R-Squared: 0.58866
## F-statistic: 54.9047 on 3 and 110 DF, p-value: < 2.22e-16
fixed<-plm(Y~X1+X2+X3, data = Data_Projek_ADP, model = "within")
summary(fixed)
## Oneway (individual) effect Within Model
##
## Call:
## plm(formula = Y ~ X1 + X2 + X3, data = Data_Projek_ADP, model = "within")
##
## Balanced Panel: n = 6, T = 19, N = 114
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -2.771388 -0.887170 -0.073985 0.794485 2.705767
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## X1 1.4275e-01 2.6880e-02 5.3105 6.153e-07 ***
## X2 7.4496e-05 8.8378e-06 8.4292 1.985e-13 ***
## X3 9.7498e+00 4.2555e+00 2.2911 0.02396 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 426.35
## Residual Sum of Squares: 157.03
## R-Squared: 0.6317
## Adj. R-Squared: 0.60364
## F-statistic: 60.0312 on 3 and 105 DF, p-value: < 2.22e-16
random<-plm(Y~X1+X2+X3, data = Data_Projek_ADP, model = "random")
summary(random)
## Oneway (individual) effect Random Effect Model
## (Swamy-Arora's transformation)
##
## Call:
## plm(formula = Y ~ X1 + X2 + X3, data = Data_Projek_ADP, model = "random")
##
## Balanced Panel: n = 6, T = 19, N = 114
##
## Effects:
## var std.dev share
## idiosyncratic 1.495 1.223 1
## individual 0.000 0.000 0
## theta: 0
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -2.524560 -0.983069 -0.053537 0.756945 3.201944
##
## Coefficients:
## Estimate Std. Error z-value Pr(>|z|)
## (Intercept) -8.9745e+00 1.8934e+00 -4.7400 2.138e-06 ***
## X1 1.3145e-01 2.6311e-02 4.9961 5.851e-07 ***
## X2 7.2389e-05 9.1886e-06 7.8782 3.322e-15 ***
## X3 1.3282e+01 4.0064e+00 3.3151 0.0009162 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 446.16
## Residual Sum of Squares: 178.65
## R-Squared: 0.59958
## Adj. R-Squared: 0.58866
## Chisq: 164.714 on 3 DF, p-value: < 2.22e-16
Pemilihan Model Terbaik
#Uji Cow
pFtest(fixed, common)
##
## F test for individual effects
##
## data: Y ~ X1 + X2 + X3
## F = 2.8919, df1 = 5, df2 = 105, p-value = 0.01737
## alternative hypothesis: significant effects
#Uji Hausman
phtest(fixed, random)
##
## Hausman Test
##
## data: Y ~ X1 + X2 + X3
## chisq = 3.5691, df = 3, p-value = 0.3119
## alternative hypothesis: one model is inconsistent
#Uji Lagrange Multipliers
plmtest(random, effect="individual", type="bp")
##
## Lagrange Multiplier Test - (Breusch-Pagan)
##
## data: Y ~ X1 + X2 + X3
## chisq = 4.4009, df = 1, p-value = 0.03592
## alternative hypothesis: significant effects
Uji Asumsi Model Terpilih (REM)
library(car)
## Loading required package: carData
##
## Attaching package: 'car'
## The following object is masked from 'package:psych':
##
## logit
library(lmtest)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
#Uji Asumsi Normalitas
residuals <- random$residuals
shapiro.test(residuals)
##
## Shapiro-Wilk normality test
##
## data: residuals
## W = 0.98238, p-value = 0.1394
plot(residuals)

#Uji Multikolinearitas
vif(random)
## X1 X2 X3
## 1.237263 1.128218 1.116716
#Uji Heteroskedastisitas
lmtest::bptest(random)
##
## studentized Breusch-Pagan test
##
## data: random
## BP = 2.6607, df = 3, p-value = 0.4469
#Uji Autokorelasi
lmtest::bgtest(random)
##
## Breusch-Godfrey test for serial correlation of order up to 1
##
## data: random
## LM test = 0.0072874, df = 1, p-value = 0.932
#Uji Signifikansi Parameter
summary(random)
## Oneway (individual) effect Random Effect Model
## (Swamy-Arora's transformation)
##
## Call:
## plm(formula = Y ~ X1 + X2 + X3, data = Data_Projek_ADP, model = "random")
##
## Balanced Panel: n = 6, T = 19, N = 114
##
## Effects:
## var std.dev share
## idiosyncratic 1.495 1.223 1
## individual 0.000 0.000 0
## theta: 0
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -2.524560 -0.983069 -0.053537 0.756945 3.201944
##
## Coefficients:
## Estimate Std. Error z-value Pr(>|z|)
## (Intercept) -8.9745e+00 1.8934e+00 -4.7400 2.138e-06 ***
## X1 1.3145e-01 2.6311e-02 4.9961 5.851e-07 ***
## X2 7.2389e-05 9.1886e-06 7.8782 3.322e-15 ***
## X3 1.3282e+01 4.0064e+00 3.3151 0.0009162 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 446.16
## Residual Sum of Squares: 178.65
## R-Squared: 0.59958
## Adj. R-Squared: 0.58866
## Chisq: 164.714 on 3 DF, p-value: < 2.22e-16