Analisis ini bertujuan untuk mengidentifikasi pola pengelompokan spasial lokal pada variabel (misalnya kemiskinan) antar kabupaten/kota di Sulawesi Selatan menggunakan metode Local Moran’s I (LISA).

Persiapan Data

data <- read.csv("D:/Youtube/Spasial/Moran.csv")
data
##                     wilayah Kemiskinan
## 1                  Bantaeng  11.000000
## 2                     Barru  29.374738
## 3                      Bone  40.959866
## 4                 Bulukumba  21.033022
## 5                  Enrekang  54.854249
## 6                      Gowa  19.634148
## 7                 Jeneponto   8.278893
## 8         Kepulauan Selayar   1.351635
## 9                      Luwu  64.561073
## 10               Luwu Timur  97.000000
## 11               Luwu Utara  89.527740
## 12                 Makassar  12.067227
## 13                    Maros  20.745629
## 14                   Palopo  71.917377
## 15 Pangkajene dan Kepulauan  12.691165
## 16                 Parepare  46.175712
## 17                  Pinrang  48.051138
## 18        Sindereng Rappang  41.482636
## 19                   Sinjai  26.369766
## 20                  Soppeng  34.781655
## 21                  Takalar   2.000000
## 22              Tana Toraja  58.417412
## 23             Toraja Utara  63.035686
## 24                     Wajo  46.799723

Persiapan Peta

library(sf)
## Linking to GEOS 3.13.1, GDAL 3.11.4, PROJ 9.7.0; sf_use_s2() is TRUE
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
shp <- st_read("D:/Youtube/Spasial/SHP/sulsel.shp")
## Reading layer `sulsel' from data source `D:\Youtube\Spasial\SHP\sulsel.shp' using driver `ESRI Shapefile'
## Simple feature collection with 24 features and 13 fields
## Geometry type: MULTIPOLYGON
## Dimension:     XY
## Bounding box:  xmin: 117.0385 ymin: -7.758941 xmax: 121.8402 ymax: -1.895236
## Geodetic CRS:  WGS 84
shp$kemiskinan <- data$Kemiskinan
shp$wilayah <- shp$NAME_2

Matriks Pemobobot

library(spdep)
## 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')`
nb <- poly2nb(shp, queen = TRUE)
## Warning in poly2nb(shp, queen = TRUE): some observations have no neighbours;
## if this seems unexpected, try increasing the snap argument.
## Warning in poly2nb(shp, queen = TRUE): neighbour object has 2 sub-graphs;
## if this sub-graph count seems unexpected, try increasing the snap argument.
lw <- nb2listw(nb, style = "W", zero.policy = TRUE)

Uji Moran’s I

# Uji Moran
moran_test <- moran.test(shp$kemiskinan, lw)

moran_test
## 
##  Moran I test under randomisation
## 
## data:  shp$kemiskinan  
## weights: lw  
## n reduced by no-neighbour observations  
## 
## Moran I statistic standard deviate = 5.6211, p-value = 9.487e-09
## alternative hypothesis: greater
## sample estimates:
## Moran I statistic       Expectation          Variance 
##        0.75385912       -0.04545455        0.02022041

Hasil uji Moran’s I menunjukkan adanya autokorelasi spasial positif yang sangat signifikan (p < 0.05) , yang berarti wilayah dengan tingkat kemiskinan tinggi cenderung bertetangga dengan wilayah yang juga berstatus miskin (membentuk pola pengelompokan atau clustering).

Menghitung Local Moran’s I (LISA)

local_moran <- localmoran(shp$kemiskinan, lw, zero.policy = TRUE)

# Tambahkan ke data
shp$Ii      <- local_moran[,1]
shp$Z.Ii    <- local_moran[,4]
shp$p_value <- local_moran[,5]

Klasifikasi Cluster (HH, LL, HL, LH)

mean_x <- mean(shp$kemiskinan)
lag_x  <- lag.listw(lw, shp$kemiskinan, zero.policy = TRUE)

shp$cluster <- "Not Significant"

shp$cluster[
  shp$kemiskinan > mean_x & lag_x > mean_x & shp$p_value < 0.05
] <- "High-High"

shp$cluster[
  shp$kemiskinan < mean_x & lag_x < mean_x & shp$p_value < 0.05
] <- "Low-Low"

shp$cluster[
  shp$kemiskinan > mean_x & lag_x < mean_x & shp$p_value < 0.05
] <- "High-Low"

shp$cluster[
  shp$kemiskinan < mean_x & lag_x > mean_x & shp$p_value < 0.05
] <- "Low-High"

Visualisasi Peta LISA

library(ggplot2)
ggplot(shp) +
  geom_sf(aes(fill = cluster), color = "black", size = 0.2) +
  scale_fill_manual(values = c(
    "High-High" = "red",
    "Low-Low" = "blue",
    "High-Low" = "orange",
    "Low-High" = "lightblue",
    "Not Significant" = "grey80"
  )) +
  labs(
    title = "Peta LISA (Local Moran’s I)",
    subtitle = "Kabupaten/Kota Sulawesi Selatan",
    fill = "Cluster"
  ) +
  theme_minimal()