Library

library(rsample)
## Warning: package 'rsample' was built under R version 4.3.2
library(DataExplorer)
## Warning: package 'DataExplorer' was built under R version 4.3.1
library(sjPlot)
## Warning: package 'sjPlot' was built under R version 4.3.2
## Learn more about sjPlot with 'browseVignettes("sjPlot")'.
library(lmtest)
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(openxlsx)
library(readxl)
library(plm)
## Warning: package 'plm' was built under R version 4.3.1
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plm':
## 
##     between, lag, lead
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(raster)
## Loading required package: sp
## 
## Attaching package: 'raster'
## The following object is masked from 'package:dplyr':
## 
##     select
library(GWmodel)
## Warning: package 'GWmodel' was built under R version 4.3.1
## Loading required package: maptools
## Warning: package 'maptools' was built under R version 4.3.1
## Please note that 'maptools' will be retired during October 2023,
## plan transition at your earliest convenience (see
## https://r-spatial.org/r/2023/05/15/evolution4.html and earlier blogs
## for guidance);some functionality will be moved to 'sp'.
##  Checking rgeos availability: FALSE
## Loading required package: robustbase
## Loading required package: Rcpp
## 
## Attaching package: 'Rcpp'
## The following object is masked from 'package:rsample':
## 
##     populate
## Loading required package: spatialreg
## Loading required package: spData
## To access larger datasets in this package, install the spDataLarge
## package with: `install.packages('spDataLarge',
## repos='https://nowosad.github.io/drat/', type='source')`
## Loading required package: Matrix
## Loading required package: sf
## Linking to GEOS 3.11.1, GDAL 3.6.2, PROJ 9.1.1; sf_use_s2() is TRUE
## Welcome to GWmodel version 2.2-9.
library(spdep)
## 
## Attaching package: 'spdep'
## The following objects are masked from 'package:spatialreg':
## 
##     get.ClusterOption, get.coresOption, get.mcOption,
##     get.VerboseOption, get.ZeroPolicyOption, set.ClusterOption,
##     set.coresOption, set.mcOption, set.VerboseOption,
##     set.ZeroPolicyOption
library(sp)
library(ggplot2)
library(ggrepel)
## Warning: package 'ggrepel' was built under R version 4.3.1

Data

df<-read_excel("D:/Kuliah/Skripsi/Proses/Data Penelitian Kedungsepur.xlsx", sheet = "Mix")
tipologi<-read_excel("D:/Kuliah/Skripsi/Proses/Data Penelitian Kedungsepur.xlsx", sheet = "Tipologi_Klassen")
head(df)
## # A tibble: 6 × 14
##   Kab       Tahun Perkapita  TPAK   UHH APM_SMA Jalan B_Modal Penduduk Penduduk2
##   <chr>     <dbl>     <dbl> <dbl> <dbl>   <dbl> <dbl>   <dbl>    <dbl>     <dbl>
## 1 Kabupate…  2017      12.9  72.2  74.5    53.6  597.  6.03e8    0.56      0.501
## 2 Kabupate…  2018      13.6  70.8  74.6    48.8  662.  4.23e8    0.469     0.469
## 3 Kabupate…  2019      14.4  69.2  74.6    49.7  700.  4.49e8    0.450     0.450
## 4 Kabupate…  2020      13.4  69.8  74.8    50.3  724.  3.67e8    5.50      5.50 
## 5 Kabupate…  2021      13.8  72.9  74.8    50.3  537.  2.90e8    0.824     0.824
## 6 Kabupate…  2022      14.5  72.0  74.9    50.2  803.  4.62e8    2.43      2.43 
## # ℹ 4 more variables: TPT <dbl>, RLS <dbl>, PAD <dbl>, Pop <dbl>
spas<-read_excel("D:/Kuliah/Skripsi/Proses/Untuk Spasial.xlsx")
head(spas)
## # A tibble: 6 × 9
##   Kab           koor_X koor_Y Y.2017 Y.2018 Y.2019 Y.2020 Y.2021 Y.2022
##   <chr>          <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
## 1 Grobogan        111.  -7.08   12.9   13.6   14.4   13.4   13.8   14.5
## 2 Demak           111.  -6.89   14.5   15.2   15.9   15.3   15.6   16.2
## 3 Semarang        110.  -7.14   31.2   32.5   34.0   33     33.9   35.4
## 4 Kendal          110.  -6.93   28.9   30.3   32.0   30.0   30.9   32.4
## 5 Salatiga        111.  -7.33   45.6   47.6   50.0   49.5   50.8   53.1
## 6 Kota Semarang   110.  -7.01   70.1   73.5   77.6   83.2   87.4   92.2

Konvergensi Beta Absolut

beta_abs<-pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) | lag(log(Perkapita),2:5), data = df, effect = "individual", model = "onestep", transformation = "d")
## Warning in pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) |
## lag(log(Perkapita), : the second-step matrix is singular, a general inverse is
## used
hasil_betaabs<-summary(beta_abs)
## Warning in vcovHC.pgmm(object): a general inverse is used
hasil_betaabs
## Oneway (individual) effect One-step model Difference GMM 
## 
## Call:
## pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) | lag(log(Perkapita), 
##     2:5), data = df, effect = "individual", model = "onestep", 
##     transformation = "d")
## 
## Balanced Panel: n = 6, T = 6, N = 36
## 
## Number of Observations Used: 24
## Residuals:
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.106175  0.013059  0.023333  0.009156  0.031709  0.077257 
## 
## Coefficients:
##                     Estimate Std. Error z-value  Pr(>|z|)    
## lag(log(Perkapita))  0.65155    0.19237   3.387 0.0007067 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Sargan test: chisq(9) = 6 (p-value = 0.73992)
## Autocorrelation test (1): normal = -2.261701 (p-value = 0.023716)
## Autocorrelation test (2): normal = -1.090421 (p-value = 0.27553)
## Wald test for coefficients: chisq(1) = 11.47164 (p-value = 0.00070666)

Konvergensi Sigma

th_2017<-df%>%filter(Tahun==2017)
th_2018<-df%>%filter(Tahun==2018)
th_2019<-df%>%filter(Tahun==2019)
th_2020<-df%>%filter(Tahun==2020)
th_2021<-df%>%filter(Tahun==2021)
th_2022<-df%>%filter(Tahun==2022)
coef.v<-function(x){
  sd(x)/mean(x)
}
kapita<-cbind(th_2017$Perkapita, th_2018$Perkapita, th_2019$Perkapita, th_2020$Perkapita, th_2021$Perkapita, th_2022$Perkapita)

hasil<-apply(kapita,2, coef.v)
data.frame(hasil)
##       hasil
## 1 0.6327042
## 2 0.6327681
## 3 0.6354291
## 4 0.6962686
## 5 0.7080072
## 6 0.7121494
absis<-c(2017:2022)
konv_sigma<-cbind(absis,hasil)
ggplot(data.frame(konv_sigma), aes(absis,hasil))+geom_line(color = "steelblue", size = 2, linetype = 1)+labs(x = "Tahun", y = "Koefisien Variasi PDRB per Kapita")+theme_classic()+theme_classic()+geom_point(color = "steelblue", size = 4)+ylim(0.4,0.8)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

Konvergensi Beta Kondisional

beta_kond<-pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + RLS + log(Jalan) + log(B_Modal) | lag(log(Perkapita),2:5), data = df, effect = "individual", model = "twosteps", transformation = "d")
## Warning in pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + RLS + :
## the second-step matrix is singular, a general inverse is used
summary(beta_kond)
## Warning in vcovHC.pgmm(object): a general inverse is used
## Oneway (individual) effect Two-steps model Difference GMM 
## 
## Call:
## pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + RLS + 
##     log(Jalan) + log(B_Modal) | lag(log(Perkapita), 2:5), data = df, 
##     effect = "individual", model = "twosteps", transformation = "d")
## 
## Balanced Panel: n = 6, T = 6, N = 36
## 
## Number of Observations Used: 24
## Residuals:
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.109317 -0.020834  0.009369 -0.001540  0.024204  0.071120 
## 
## Coefficients:
##                        Estimate  Std. Error z-value  Pr(>|z|)    
## lag(log(Perkapita))  0.38673967  0.19632665  1.9699   0.04885 *  
## TPT                 -0.00081507  0.00343708 -0.2371   0.81255    
## RLS                  0.13506110  0.05679198  2.3782   0.01740 *  
## log(Jalan)          -0.06548987  0.01249063 -5.2431 1.579e-07 ***
## log(B_Modal)         0.02534520  0.04542690  0.5579   0.57689    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Sargan test: chisq(9) = 2.406028 (p-value = 0.9833)
## Autocorrelation test (1): normal = -0.9723791 (p-value = 0.33086)
## Autocorrelation test (2): normal = 0.2784977 (p-value = 0.78063)
## Wald test for coefficients: chisq(5) = 188.3352 (p-value = < 2.22e-16)
beta_kond1<-pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPAK + RLS + log(Jalan) + log(PAD) + log(Penduduk) | lag(log(Perkapita),2:5), data = df, effect = "individual", model = "twosteps", transformation = "d")
## Warning in get(.Generic)(x, ...): NaNs produced
## Warning in pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPAK + : the
## second-step matrix is singular, a general inverse is used
summary(beta_kond1)
## Warning in vcovHC.pgmm(object): a general inverse is used
## Oneway (individual) effect Two-steps model Difference GMM 
## 
## Call:
## pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPAK + 
##     RLS + log(Jalan) + log(PAD) + log(Penduduk) | lag(log(Perkapita), 
##     2:5), data = df, effect = "individual", model = "twosteps", 
##     transformation = "d")
## 
## Balanced Panel: n = 6, T = 6, N = 36
## 
## Number of Observations Used: 22
## Residuals:
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.108515 -0.021180  0.000000  0.002133  0.047256  0.136449 
## 
## Coefficients:
##                        Estimate  Std. Error z-value  Pr(>|z|)    
## lag(log(Perkapita))  0.71569813  0.28771209  2.4875  0.012863 *  
## TPAK                -0.00027157  0.00326552 -0.0832  0.933723    
## RLS                  0.15316193  0.03741034  4.0941 4.238e-05 ***
## log(Jalan)          -0.16636583  0.07616459 -2.1843  0.028941 *  
## log(PAD)            -0.37797574  0.17606344 -2.1468  0.031808 *  
## log(Penduduk)       -0.05733333  0.01802192 -3.1813  0.001466 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Sargan test: chisq(9) = -1.694308e-14 (p-value = 1)
## Autocorrelation test (1): normal = -1.417319 (p-value = 0.15639)
## Autocorrelation test (2): normal = -0.09798819 (p-value = 0.92194)
## Wald test for coefficients: chisq(6) = 451.8795 (p-value = < 2.22e-16)
beta_kond2<-pgmm(formula = Perkapita ~ lag(Perkapita) + TPT + APM_SMA + log(Jalan) + log(PAD) + Penduduk | lag(Perkapita,2:5), data = df, effect = "individual", model = "twosteps", transformation = "d")
## Warning in pgmm(formula = Perkapita ~ lag(Perkapita) + TPT + APM_SMA +
## log(Jalan) + : the second-step matrix is singular, a general inverse is used
summary(beta_kond2)
## Warning in vcovHC.pgmm(object): a general inverse is used
## Oneway (individual) effect Two-steps model Difference GMM 
## 
## Call:
## pgmm(formula = Perkapita ~ lag(Perkapita) + TPT + APM_SMA + log(Jalan) + 
##     log(PAD) + Penduduk | lag(Perkapita, 2:5), data = df, effect = "individual", 
##     model = "twosteps", transformation = "d")
## 
## Balanced Panel: n = 6, T = 6, N = 36
## 
## Number of Observations Used: 24
## Residuals:
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -3.089453 -0.787216  0.175919  0.002156  0.677130  3.430970 
## 
## Coefficients:
##                Estimate Std. Error z-value Pr(>|z|)    
## lag(Perkapita)  1.10455    0.11711  9.4316  < 2e-16 ***
## TPT            -0.61738    0.52998 -1.1649  0.24405    
## APM_SMA         0.20067    0.16622  1.2072  0.22734    
## log(Jalan)      0.46005    2.90282  0.1585  0.87408    
## log(PAD)        2.15837    5.23770  0.4121  0.68028    
## Penduduk       -0.38094    0.14552 -2.6178  0.00885 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Sargan test: chisq(9) = 7.293026e-16 (p-value = 1)
## Autocorrelation test (1): normal = -1.1002 (p-value = 0.27125)
## Autocorrelation test (2): normal = -1.078665 (p-value = 0.28074)
## Wald test for coefficients: chisq(6) = 2370.822 (p-value = < 2.22e-16)
beta_kond3<-pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + APM_SMA + log(Jalan) + log(B_Modal) + log(Pop) | lag(log(Perkapita),2:5), data = df, effect = "individual", model = "onestep", transformation = "d")
## Warning in pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + APM_SMA
## + : the second-step matrix is singular, a general inverse is used
summary(beta_kond3)
## Warning in vcovHC.pgmm(object): a general inverse is used
## Oneway (individual) effect One-step model Difference GMM 
## 
## Call:
## pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + APM_SMA + 
##     log(Jalan) + log(B_Modal) + log(Pop) | lag(log(Perkapita), 
##     2:5), data = df, effect = "individual", model = "onestep", 
##     transformation = "d")
## 
## Balanced Panel: n = 6, T = 6, N = 36
## 
## Number of Observations Used: 24
## Residuals:
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.076001 -0.009788  0.012606  0.007274  0.035970  0.074233 
## 
## Coefficients:
##                       Estimate Std. Error z-value  Pr(>|z|)    
## lag(log(Perkapita))  0.7220891  0.1514193  4.7688 1.853e-06 ***
## TPT                 -0.0099624  0.0048137 -2.0696  0.038491 *  
## APM_SMA              0.0206435  0.0075782  2.7241  0.006448 ** 
## log(Jalan)          -0.0469333  0.0231477 -2.0276  0.042605 *  
## log(B_Modal)         0.0120234  0.0148276  0.8109  0.417432    
## log(Pop)            -0.6104167  0.1958606 -3.1166  0.001830 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Sargan test: chisq(9) = 6 (p-value = 0.73992)
## Autocorrelation test (1): normal = -1.72813 (p-value = 0.083965)
## Autocorrelation test (2): normal = -0.3295996 (p-value = 0.7417)
## Wald test for coefficients: chisq(6) = 47804357287 (p-value = < 2.22e-16)
#used
beta_kond4<-pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + RLS + log(Jalan) + log(PAD) + log(Pop) | lag(log(Perkapita),2:5), data = df, effect = "individual", model = "onestep", transformation = "d")
## Warning in pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + RLS + :
## the second-step matrix is singular, a general inverse is used
summary(beta_kond4)
## Warning in vcovHC.pgmm(object): a general inverse is used
## Oneway (individual) effect One-step model Difference GMM 
## 
## Call:
## pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + RLS + 
##     log(Jalan) + log(PAD) + log(Pop) | lag(log(Perkapita), 2:5), 
##     data = df, effect = "individual", model = "onestep", transformation = "d")
## 
## Balanced Panel: n = 6, T = 6, N = 36
## 
## Number of Observations Used: 24
## Residuals:
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.049842 -0.013536  0.001241  0.004627  0.025371  0.055739 
## 
## Coefficients:
##                       Estimate Std. Error z-value  Pr(>|z|)    
## lag(log(Perkapita))  0.3354926  0.1141577  2.9389 0.0032943 ** 
## TPT                 -0.0094963  0.0039892 -2.3805 0.0172888 *  
## RLS                  0.1552862  0.0428298  3.6257 0.0002882 ***
## log(Jalan)          -0.0393359  0.0175230 -2.2448 0.0247800 *  
## log(PAD)             0.0525238  0.0453136  1.1591 0.2464086    
## log(Pop)            -1.1025692  0.2667011 -4.1341 3.563e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Sargan test: chisq(9) = 6 (p-value = 0.73992)
## Autocorrelation test (1): normal = -1.65149 (p-value = 0.098639)
## Autocorrelation test (2): normal = -1.31262 (p-value = 0.18931)
## Wald test for coefficients: chisq(6) = 156037866984 (p-value = < 2.22e-16)
beta_kond5<-pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + UHH + log(Jalan) + log(B_Modal) + log(Pop) | lag(log(Perkapita),2:5), data = df, effect = "individual", model = "onestep", transformation = "d")
## Warning in pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + UHH + :
## the second-step matrix is singular, a general inverse is used
summary(beta_kond5)
## Warning in vcovHC.pgmm(object): a general inverse is used
## Oneway (individual) effect One-step model Difference GMM 
## 
## Call:
## pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPT + UHH + 
##     log(Jalan) + log(B_Modal) + log(Pop) | lag(log(Perkapita), 
##     2:5), data = df, effect = "individual", model = "onestep", 
##     transformation = "d")
## 
## Balanced Panel: n = 6, T = 6, N = 36
## 
## Number of Observations Used: 24
## Residuals:
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.063750 -0.006829  0.006232  0.005193  0.021734  0.055810 
## 
## Coefficients:
##                       Estimate Std. Error z-value  Pr(>|z|)    
## lag(log(Perkapita))  0.2005428  0.0952021  2.1065 0.0351613 *  
## TPT                 -0.0080818  0.0027110 -2.9811 0.0028723 ** 
## UHH                  0.2593844  0.0539367  4.8091 1.516e-06 ***
## log(Jalan)          -0.0466807  0.0165201 -2.8257 0.0047178 ** 
## log(B_Modal)         0.0309465  0.0178288  1.7358 0.0826070 .  
## log(Pop)            -0.7408489  0.2088507 -3.5473 0.0003893 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Sargan test: chisq(9) = 6 (p-value = 0.73992)
## Autocorrelation test (1): normal = -1.736184 (p-value = 0.082531)
## Autocorrelation test (2): normal = 0.5091246 (p-value = 0.61066)
## Wald test for coefficients: chisq(6) = 45711014767 (p-value = < 2.22e-16)
beta_kond6<-pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPAK + APM_SMA + log(Jalan) + log(B_Modal) + log(Pop) | lag(log(Perkapita),2:5), data = df, effect = "individual", model = "onestep", transformation = "d")
## Warning in pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPAK + : the
## second-step matrix is singular, a general inverse is used
summary(beta_kond6)
## Warning in vcovHC.pgmm(object): a general inverse is used
## Oneway (individual) effect One-step model Difference GMM 
## 
## Call:
## pgmm(formula = log(Perkapita) ~ lag(log(Perkapita)) + TPAK + 
##     APM_SMA + log(Jalan) + log(B_Modal) + log(Pop) | lag(log(Perkapita), 
##     2:5), data = df, effect = "individual", model = "onestep", 
##     transformation = "d")
## 
## Balanced Panel: n = 6, T = 6, N = 36
## 
## Number of Observations Used: 24
## Residuals:
##      Min.   1st Qu.    Median      Mean   3rd Qu.      Max. 
## -0.085510 -0.021720  0.021293  0.008125  0.035250  0.056287 
## 
## Coefficients:
##                       Estimate Std. Error z-value  Pr(>|z|)    
## lag(log(Perkapita))  0.5419092  0.1224288  4.4263 9.585e-06 ***
## TPAK                 0.0022953  0.0035790  0.6413    0.5213    
## APM_SMA              0.0134020  0.0069381  1.9317    0.0534 .  
## log(Jalan)          -0.0554194  0.0139432 -3.9747 7.048e-05 ***
## log(B_Modal)         0.0138707  0.0169750  0.8171    0.4139    
## log(Pop)            -0.4645985  0.2039076 -2.2785    0.0227 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Sargan test: chisq(9) = 6 (p-value = 0.73992)
## Autocorrelation test (1): normal = -1.987902 (p-value = 0.046823)
## Autocorrelation test (2): normal = -0.4859579 (p-value = 0.627)
## Wald test for coefficients: chisq(6) = 5.957979e+12 (p-value = < 2.22e-16)

Uji Morans I

spas.2017 = spas$Y.2017
spas.2018 = spas$Y.2018
spas.2019 = spas$Y.2019
spas.2020 = spas$Y.2020
spas.2021 = spas$Y.2021
spas.2022 = spas$Y.2022
longlat = cbind(spas$koor_X, spas$koor_Y)
#1/Jarak
w1<-as.matrix(1/dist(longlat))
dlist1 = mat2listw(w1, style = "W")
#kNN
k1 = knn2nb(knearneigh(longlat, k = 1))
W<-nb2mat(k1)
dlist2 = mat2listw(W, style = "W")
spKedungsepur = shapefile("D:/Kuliah/Skripsi/Proses/Peta/Kedungsepur.shp")
queen.nb=poly2nb(spKedungsepur) 
#Pembobot queen 
queen.kedungsepur=nb2listw(queen.nb,style="W",zero.policy=TRUE) 
#Menyimpan Matriks Pembobot 
bobot.queen = listw2mat(queen.kedungsepur) 
bobot.queen = mat2listw(bobot.queen)
## Warning in mat2listw(bobot.queen): style is M (missing); style should be set to
## a valid value

Dengan Bobot Queen

moran.test(spas.2022, queen.kedungsepur, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2022  
## weights: queen.kedungsepur    
## 
## Moran I statistic standard deviate = 0.32644, p-value = 0.372
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       -0.12639092       -0.20000000        0.05084656
moran.test(spas.2021, queen.kedungsepur, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2021  
## weights: queen.kedungsepur    
## 
## Moran I statistic standard deviate = 0.34884, p-value = 0.3636
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       -0.12133894       -0.20000000        0.05084656
moran.test(spas.2020, queen.kedungsepur, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2020  
## weights: queen.kedungsepur    
## 
## Moran I statistic standard deviate = 0.4101, p-value = 0.3409
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       -0.10752499       -0.20000000        0.05084656
moran.test(spas.2019, queen.kedungsepur, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2019  
## weights: queen.kedungsepur    
## 
## Moran I statistic standard deviate = 0.59458, p-value = 0.2761
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       -0.06592791       -0.20000000        0.05084656
moran.test(spas.2018, queen.kedungsepur, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2018  
## weights: queen.kedungsepur    
## 
## Moran I statistic standard deviate = 0.61717, p-value = 0.2686
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       -0.06083221       -0.20000000        0.05084656
moran.test(spas.2017, queen.kedungsepur, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2017  
## weights: queen.kedungsepur    
## 
## Moran I statistic standard deviate = 0.63358, p-value = 0.2632
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##       -0.05713311       -0.20000000        0.05084656

Dengan Bobot k-NN

moran.test(spas.2022, dlist2, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2022  
## weights: dlist2    
## 
## Moran I statistic standard deviate = -0.55493, p-value = 0.7105
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##        -0.3937518        -0.2000000         0.1219048
moran.test(spas.2021, dlist2, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2021  
## weights: dlist2    
## 
## Moran I statistic standard deviate = -0.53598, p-value = 0.704
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##        -0.3871384        -0.2000000         0.1219048
moran.test(spas.2020, dlist2, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2020  
## weights: dlist2    
## 
## Moran I statistic standard deviate = -0.50824, p-value = 0.6944
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##        -0.3774524        -0.2000000         0.1219048
moran.test(spas.2019, dlist2, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2019  
## weights: dlist2    
## 
## Moran I statistic standard deviate = -0.34222, p-value = 0.6339
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##        -0.3194868        -0.2000000         0.1219048
moran.test(spas.2018, dlist2, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2018  
## weights: dlist2    
## 
## Moran I statistic standard deviate = -0.32032, p-value = 0.6256
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##        -0.3118390        -0.2000000         0.1219048
moran.test(spas.2017, dlist2, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2017  
## weights: dlist2    
## 
## Moran I statistic standard deviate = -0.30922, p-value = 0.6214
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##        -0.3079628        -0.2000000         0.1219048

Dengan Bobot 1/Jarak

moran.test(spas.2022, dlist1, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2022  
## weights: dlist1    
## 
## Moran I statistic standard deviate = 0.016467, p-value = 0.4934
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##      -0.198699485      -0.200000000       0.006237433
moran.test(spas.2021, dlist1, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2021  
## weights: dlist1    
## 
## Moran I statistic standard deviate = 0.03418, p-value = 0.4864
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##      -0.197300591      -0.200000000       0.006237433
moran.test(spas.2020, dlist1, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2020  
## weights: dlist1    
## 
## Moran I statistic standard deviate = 0.06047, p-value = 0.4759
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##      -0.195224227      -0.200000000       0.006237433
moran.test(spas.2019, dlist1, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2019  
## weights: dlist1    
## 
## Moran I statistic standard deviate = 0.25539, p-value = 0.3992
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##      -0.179829563      -0.200000000       0.006237433
moran.test(spas.2018, dlist1, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2018  
## weights: dlist1    
## 
## Moran I statistic standard deviate = 0.27348, p-value = 0.3922
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##      -0.178401412      -0.200000000       0.006237433
moran.test(spas.2017, dlist1, randomisation = F, zero.policy = T)
## 
##  Moran I test under normality
## 
## data:  spas.2017  
## weights: dlist1    
## 
## Moran I statistic standard deviate = 0.28068, p-value = 0.3895
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##      -0.177832850      -0.200000000       0.006237433

Tipologi Klassen

# create empty theme to clear the plot area
empty_theme <- theme(                              
  plot.background = element_blank(), 
  panel.grid.major = element_blank(), 
  panel.grid.minor = element_blank(), 
  panel.border = element_blank(), 
  panel.background = element_blank(),
  axis.line = element_blank(),
  axis.ticks = element_blank(),
  axis.text.y = element_text(angle = 90)
)

# create sample data
tipologi_2017<-cbind(tipologi$Daerah,tipologi$Perkapita_2017,tipologi$PE_2017)
tipologi_2018<-cbind(tipologi$Perkapita_2018,tipologi$PE_2018)
tipologi_2019<-cbind(tipologi$Perkapita_2019,tipologi$PE_2019)
tipologi_2020<-cbind(tipologi$Perkapita_2020,tipologi$PE_2020)
tipologi_2021<-cbind(tipologi$Perkapita_2021,tipologi$PE_2021)
tipologi_2022<-cbind(tipologi$Perkapita_2022,tipologi$PE_2022)
tipologi_2017<-as.data.frame(tipologi_2017)

# create plot
ggplot(tipologi, aes(x = Perkapita_2017, y = PE_2017, label = Daerah)) +
  coord_fixed() +
  scale_x_continuous(expand = c(0, 0), limits = c(0, 80), breaks = c(12,60),
                     labels=c("12" = "Low", "60" = "High")) +
  scale_y_continuous(expand = c(0, 0), limits = c(-20,20), breaks = c(-8,16),
                     labels=c("5.5" = "Low", "6.5" = "High")) +
  empty_theme +
  labs(title = "Tipologi Klassen Kedungsepur Tahun 2017",
       x = "PDRB per kapita",
       y = "Pertumbuhan Ekonomi") +
  geom_vline(xintercept = 35.08) +
  geom_hline(yintercept = 6.26) +
  geom_point(colour = "black", size = 1) +
  geom_label_repel(size = 3,
                   fill = "deepskyblue",
                   colour = "black",
                   min.segment.length = unit(0, "lines"))

# create plot
ggplot(tipologi, aes(x = Perkapita_2022, y = PE_2022, label = Daerah)) +
  coord_fixed() +
  scale_x_continuous(expand = c(0, 0), limits = c(0, 120), breaks = c(18,80),
                     labels=c("12" = "Low", "60" = "High")) +
  scale_y_continuous(expand = c(0, 0), limits = c(-20,20), breaks = c(-8,16),
                     labels=c("5.5" = "Low", "6.5" = "High")) +
  empty_theme +
  labs(title = "Tipologi Klassen Kedungsepur Tahun 2022",
       x = "PDRB per kapita",
       y = "Pertumbuhan Ekonomi") +
  geom_vline(xintercept = 41.47) +
  geom_hline(yintercept = 5.65) +
  geom_point(colour = "black", size = 1) +
  geom_label_repel(size = 3,
                   fill = "deepskyblue",
                   colour = "black",
                   min.segment.length = unit(0, "lines"))