Multikolinearitas dapat membuat estimasi koefisien regresi tidak stabil, dan pada Geographically Weighted Regression (GWR) masalah ini dapat muncul berbeda di setiap lokasi sehingga belum tentu terdeteksi oleh diagnosis global. Penelitian ini bertujuan mendeteksi multikolinearitas lokal pada model GWR kemiskinan serta mengidentifikasi wilayah yang koefisiennya berpotensi tidak stabil. Data yang digunakan adalah data sensus Georgia tahun 1990 (159 county) dengan persentase penduduk miskin sebagai variabel terikat serta persentase lulusan sarjana, penduduk pedesaan, dan penduduk lansia sebagai variabel bebas. Setelah diagnosis global dengan korelasi dan VIF, model GWR dibangun menggunakan kernel bisquare dengan bandwidth adaptif berdasarkan AICc, lalu multikolinearitas lokal didiagnosis dengan local VIF, local condition number (CN), dan VDP serta dipetakan. Hasil menunjukkan tidak terdapat multikolinearitas global dan GWR jauh lebih baik daripada regresi global. Local VIF tidak mengindikasikan multikolinearitas, tetapi local CN mendeteksi sekelompok kecil county di Georgia tengah-timur dan perbatasan selatan dengan kolinearitas lokal yang melibatkan intersep, lulusan sarjana, dan penduduk lansia. Kolinearitas ini membentuk klaster spasial signifikan dan melemah saat bandwidth diperbesar. Dengan demikian, local CN dan VDP perlu digunakan bersama local VIF, dan koefisien GWR di wilayah tersebut perlu ditafsirkan secara hati-hati.
Kata kunci: Geographically Weighted Regression, multikolinearitas lokal, local condition number, kemiskinan
Kemiskinan merupakan fenomena yang tidak tersebar merata secara geografis. Wilayah yang berdekatan cenderung memiliki karakteristik sosial-ekonomi yang mirip, misalnya tingkat pendidikan, struktur permukiman, dan komposisi umur penduduk. Akibatnya, hubungan antara kemiskinan dan faktor-faktor yang memengaruhinya dapat berbeda dari satu wilayah ke wilayah lain. Regresi linier global atau Ordinary Least Squares (OLS) mengasumsikan bahwa hubungan tersebut sama di seluruh lokasi, sehingga kurang mampu menangkap variasi spasial tersebut.
Geographically Weighted Regression (GWR) dikembangkan untuk mengatasi keterbatasan tersebut dengan mengestimasi koefisien regresi secara lokal pada setiap lokasi pengamatan [1], [2]. Setiap estimasi lokal hanya memanfaatkan sebagian data di sekitar lokasi yang diberi bobot berdasarkan jarak. Konsekuensinya, kondisi data yang baik secara global belum tentu baik secara lokal. Dua prediktor yang korelasinya lemah pada seluruh wilayah dapat berkorelasi kuat pada subwilayah tertentu, sehingga muncul multikolinearitas lokal [3].
Multikolinearitas lokal dapat menyebabkan koefisien GWR menjadi tidak stabil, memiliki tanda yang berlawanan dengan teori, atau berkorelasi kuat satu sama lain [3], [4]. Masalah ini tidak selalu terdeteksi oleh Variance Inflation Factor (VIF) pada model OLS karena VIF global hanya menggambarkan kondisi rata-rata seluruh wilayah. Oleh karena itu, diperlukan diagnosis lokal, yaitu local VIF, local condition number (local CN), dan variance decomposition proportion (VDP), yang dihitung di setiap lokasi [4], [5]. Laporan ini menerapkan ketiga diagnosis tersebut pada model GWR kemiskinan di 159 county Negara Bagian Georgia, Amerika Serikat.
PctBach, PctRural, dan
PctEld?Hasil laporan ini dapat menjadi dasar dalam menilai keandalan interpretasi koefisien GWR. County yang terindikasi multikolinearitas lokal perlu ditafsirkan lebih hati-hati, sedangkan county lainnya dapat ditafsirkan dengan keyakinan yang lebih tinggi. Secara metodologis, laporan ini juga menunjukkan alur kerja diagnosis kolinearitas lokal yang dapat diterapkan pada data spasial lain.
Regresi linier berganda memodelkan hubungan antara satu variabel terikat dan beberapa variabel bebas dengan koefisien yang sama untuk seluruh lokasi:
\[ y_i = \beta_0 + \sum_{k=1}^{p} \beta_k x_{ik} + \varepsilon_i, \qquad \varepsilon_i \sim N(0, \sigma^2) \tag{1} \]
dengan \(y_i\) adalah nilai variabel terikat pada lokasi ke-\(i\), \(x_{ik}\) adalah nilai prediktor ke-\(k\), \(\beta_k\) adalah koefisien regresi global, \(p\) adalah banyaknya prediktor, dan \(\varepsilon_i\) adalah galat. Koefisien diestimasi dengan metode kuadrat terkecil.
GWR memperluas regresi linier dengan membiarkan koefisien berubah menurut lokasi geografis \((u_i, v_i)\) [1], [2]:
\[ y_i = \beta_0(u_i, v_i) + \sum_{k=1}^{p} \beta_k(u_i, v_i)\, x_{ik} + \varepsilon_i \tag{2} \]
Koefisien pada setiap lokasi diestimasi dengan weighted least squares:
\[ \hat{\boldsymbol{\beta}}(u_i, v_i) = \left( \mathbf{X}^{\top} \mathbf{W}(u_i, v_i) \mathbf{X} \right)^{-1} \mathbf{X}^{\top} \mathbf{W}(u_i, v_i)\, \mathbf{y} \tag{3} \]
\[ \mathbf{W}(u_i, v_i) = \operatorname{diag}\left( w_{i1}, w_{i2}, \ldots, w_{in} \right) \tag{4} \]
dengan \(\mathbf{X}\) adalah matriks prediktor berukuran \(n \times (p+1)\) yang kolom pertamanya bernilai 1 (intersep), \(\mathbf{y}\) adalah vektor variabel terikat, dan \(\mathbf{W}(u_i, v_i)\) adalah matriks diagonal bobot spasial untuk lokasi ke-\(i\). Persamaan (3) menunjukkan bahwa kestabilan estimasi lokal bergantung pada matriks \(\mathbf{X}^{\top}\mathbf{W}(u_i, v_i)\mathbf{X}\). Jika kolom-kolom \(\mathbf{X}\) yang telah diberi bobot hampir saling bergantung linier, matriks tersebut mendekati singular dan estimasi koefisien menjadi tidak stabil.
Bobot \(w_{ij}\) ditentukan oleh fungsi kernel. Laporan ini menggunakan kernel bisquare adaptif:
\[ w_{ij} = \begin{cases} \left[ 1 - \left( \dfrac{d_{ij}}{b_i} \right)^{2} \right]^{2}, & d_{ij} < b_i \\[6pt] 0, & d_{ij} \geq b_i \end{cases} \tag{5} \]
dengan \(d_{ij}\) adalah jarak Euclidean antara lokasi \(i\) dan \(j\), sedangkan \(b_i\) adalah jarak dari lokasi \(i\) ke tetangga terdekat ke-\(N\). Pada bandwidth adaptif, \(N\) (banyaknya tetangga) bernilai sama untuk semua lokasi sehingga wilayah yang jarang datanya memperoleh radius yang lebih lebar. Nilai \(N\) optimal dipilih dengan meminimumkan corrected Akaike Information Criterion (AICc) [2]:
\[ \mathrm{AIC_c} = 2n \ln(\hat{\sigma}) + n \ln(2\pi) + n \left\{ \frac{n + \operatorname{tr}(\mathbf{S})}{n - 2 - \operatorname{tr}(\mathbf{S})} \right\} \tag{6} \]
dengan \(n\) adalah banyaknya observasi, \(\hat{\sigma}\) adalah estimasi simpangan baku galat, dan \(\mathbf{S}\) adalah hat matrix GWR sehingga \(\hat{\mathbf{y}} = \mathbf{S}\mathbf{y}\). Model dengan AICc lebih kecil dinilai lebih baik; selisih AICc lebih dari 3 umumnya dianggap bermakna.
Multikolinearitas adalah kondisi ketika dua atau lebih prediktor saling berhubungan linier kuat. Diagnosis awal dilakukan dengan koefisien korelasi Pearson antarprediktor:
\[ r_{jk} = \frac{\sum_{i=1}^{n} (x_{ij} - \bar{x}_j)(x_{ik} - \bar{x}_k)}{\sqrt{\sum_{i=1}^{n} (x_{ij} - \bar{x}_j)^2}\, \sqrt{\sum_{i=1}^{n} (x_{ik} - \bar{x}_k)^2}} \tag{7} \]
Selanjutnya, VIF mengukur seberapa besar varians estimasi koefisien membesar akibat hubungan prediktor ke-\(k\) dengan prediktor lain:
\[ \mathrm{VIF}_k = \frac{1}{1 - R_k^{2}} \tag{8} \]
dengan \(R_k^2\) adalah koefisien determinasi dari regresi prediktor ke-\(k\) terhadap prediktor lainnya. Nilai VIF > 10 umumnya digunakan sebagai indikasi multikolinearitas serius [6].
Local VIF dihitung dengan cara yang sama seperti VIF global, tetapi menggunakan regresi berbobot pada setiap lokasi [4], [5]:
\[ \mathrm{VIF}_k(u_i, v_i) = \frac{1}{1 - R_k^{2}(u_i, v_i)} \tag{9} \]
dengan \(R_k^2(u_i, v_i)\) adalah koefisien determinasi lokal dari regresi berbobot prediktor ke-\(k\) terhadap prediktor lain di sekitar lokasi \(i\). Kelemahan local VIF adalah tidak memperhitungkan keterlibatan intersep dalam ketergantungan linier.
Local CN mengukur seberapa dekat matriks desain berbobot dengan kondisi singular. Pertama, matriks desain diberi bobot dan setiap kolomnya diskalakan menjadi panjang satu:
\[ \mathbf{X}_w(i) = \mathbf{W}^{1/2}(u_i, v_i)\, \mathbf{X} \tag{10} \]
Kemudian dilakukan dekomposisi nilai singular (SVD) \(\mathbf{X}_w(i) = \mathbf{U}\mathbf{D}\mathbf{V}^{\top}\), dengan \(\mathbf{D} = \operatorname{diag}(\mu_1, \ldots, \mu_{p+1})\) berisi nilai singular. Local CN didefinisikan sebagai [4], [7]:
\[ \kappa(u_i, v_i) = \frac{\mu_{\max}(i)}{\mu_{\min}(i)} = \sqrt{\frac{\lambda_{\max}(i)}{\lambda_{\min}(i)}} \tag{11} \]
dengan \(\lambda\) adalah nilai eigen dari \(\mathbf{X}_w^{\top}\mathbf{X}_w\). Berbeda dari local VIF, local CN ikut memperhitungkan intersep sehingga dapat menangkap ketergantungan antara prediktor dan konstanta.
VDP menunjukkan proporsi varians estimasi koefisien ke-\(k\) yang berasal dari komponen ke-\(j\) (komponen dengan nilai singular terkecil) [7]:
\[ \pi_{jk}(i) = \frac{v_{kj}^{2} / \mu_j^{2}}{\sum_{l=1}^{p+1} v_{kl}^{2} / \mu_l^{2}} \tag{12} \]
dengan \(v_{kj}\) adalah elemen matriks \(\mathbf{V}\) dari SVD. Prediktor yang memiliki VDP tinggi pada komponen yang sama adalah prediktor yang saling bergantung linier. Kriteria yang digunakan dalam laporan ini dirangkum pada Tabel 1.
| Ukuran | Ambang batas | Arti sederhana |
|---|---|---|
| Local VIF | > 10 | Varians koefisien prediktor membesar lebih dari 10 kali akibat prediktor lain di sekitar lokasi tersebut |
| Local CN | < 20 (rendah); 20โ30 (sedang); > 30 (tinggi) | Semakin besar, semakin dekat matriks data lokal dengan kondisi singular; > 30 menandakan kolinearitas yang perlu diwaspadai |
| VDP | > 0,5 pada โฅ 2 komponen (dengan CN > 30) | Menunjukkan prediktor atau intersep mana yang terlibat dalam ketergantungan linier |
Sumber: Belsley dkk. [7]; Wheeler [4]; Gollini dkk. [5].
Untuk mengetahui apakah nilai suatu variabel (misalnya
PctPov atau local CN) mengelompok secara
geografis, digunakan Global Moranโs I [8]:
\[ I = \frac{n}{\sum_{i=1}^{n} \sum_{j=1}^{n} w_{ij}} \cdot \frac{\sum_{i=1}^{n} \sum_{j=1}^{n} w_{ij} (x_i - \bar{x})(x_j - \bar{x})}{\sum_{i=1}^{n} (x_i - \bar{x})^{2}} \tag{13} \]
\[ Z(I) = \frac{I - E(I)}{\sqrt{\operatorname{Var}(I)}}, \qquad E(I) = -\frac{1}{n - 1} \tag{14} \]
Nilai \(I\) positif dan signifikan berarti nilai yang mirip cenderung berdekatan. Untuk melihat lokasi kelompoknya, digunakan Local Indicators of Spatial Association (LISA) [9]:
\[ I_i = \frac{x_i - \bar{x}}{m_2} \sum_{j=1}^{n} w_{ij} (x_j - \bar{x}), \qquad m_2 = \frac{1}{n} \sum_{i=1}^{n} (x_i - \bar{x})^{2} \tag{15} \]
Berdasarkan nilai terpusat dan spatial lag-nya, setiap county diklasifikasikan menjadi High-High, Low-Low, High-Low, atau Low-High. Matriks bobot \(w_{ij}\) pada uji Moranโs I dan LISA dibentuk dari 5 tetangga terdekat (k-nearest neighbours, \(k = 5\)) yang distandardisasi baris.
Data yang digunakan adalah data sekunder Georgia dataset dari
GeoDa yang bersumber dari sensus Amerika Serikat tahun 1990.
Data mencakup 159 county di Negara Bagian Georgia dengan 13
kolom, antara lain kode wilayah (AreaKey), koordinat
proyeksi (X, Y), serta indikator
sosial-ekonomi. Batas wilayah county untuk pemetaan diambil
dari shapefile TIGER/Line melalui paket tigris
dan digabungkan berdasarkan kode FIPS (AreaKey =
GEOID).
| Jenis | Variabel | Keterangan | Penjelasan sederhana |
|---|---|---|---|
| Dependen (Y) |
PctPov
|
Persentase penduduk miskin | Dari setiap 100 penduduk di suatu county, berapa orang yang hidup di bawah garis kemiskinan. Contoh: PctPov = 20 berarti 20 dari 100 penduduk tergolong miskin. |
| Independen (X1) |
PctBach
|
Persentase lulusan sarjana | Dari setiap 100 penduduk dewasa, berapa orang yang berpendidikan minimal sarjana (S1). Menggambarkan tingkat pendidikan. |
| Independen (X2) |
PctRural
|
Persentase kawasan pedesaan | Dari setiap 100 penduduk, berapa orang yang tinggal di wilayah pedesaan. Nilai 100 berarti county sepenuhnya pedesaan. |
| Independen (X3) |
PctEld
|
Persentase penduduk lansia | Dari setiap 100 penduduk, berapa orang yang berusia lanjut (65 tahun ke atas). Menggambarkan struktur umur penduduk. |
Seluruh variabel berbentuk persentase sehingga satuannya sama, yaitu persen (%). Dengan variabel tersebut, model regresi global yang digunakan adalah:
\[ \mathrm{PctPov}_i = \beta_0 + \beta_1\, \mathrm{PctBach}_i + \beta_2\, \mathrm{PctRural}_i + \beta_3\, \mathrm{PctEld}_i + \varepsilon_i \tag{16} \]
sedangkan model GWR-nya adalah:
\[ \mathrm{PctPov}_i = \beta_0(u_i,v_i) + \beta_1(u_i,v_i)\, \mathrm{PctBach}_i + \beta_2(u_i,v_i)\, \mathrm{PctRural}_i + \beta_3(u_i,v_i)\, \mathrm{PctEld}_i + \varepsilon_i \tag{17} \]
Analisis dilakukan menggunakan R dengan paket GWmodel, sp, car, spdep, sf, tigris, leaflet, plotly, DT, dan kableExtra. Tahapannya adalah sebagai berikut.
AreaKey, duplikasi koordinat, dan rentang nilai variabel.
PctPov, matriks korelasi antarprediktor, dan Global Moranโs
I untuk PctPov.
bw.gwr), membangun model GWR kernel
bisquare (gwr.basic), lalu membandingkannya dengan
OLS berdasarkan Rยฒ, adjusted Rยฒ, dan AICc.
gwr.collin.diagno dengan bandwidth dan kernel yang
sama, lalu mengidentifikasi county dengan local VIF >
10 atau local CN > 30.
Data Georgia sudah ditanam di dalam file .Rmd ini,
sehingga file CSV terpisah tidak wajib. Jika ada file CSV Georgia di
folder yang sama, file tersebut yang dipakai. Batas wilayah
county diunduh otomatis melalui paket tigris
(butuh koneksi internet). Klik tombol Code di kanan
atas setiap keluaran untuk melihat sintaks R-nya, atau tombol
Code โ Download Rmd di bagian judul untuk mengunduh
file sumber.
# Paket yang digunakan --------------------------------------------------------
paket <- c("GWmodel", "sp", "car", "spdep", "sf", "tigris", "dplyr",
"ggplot2", "tidyr", "leaflet", "plotly", "DT", "kableExtra", "htmltools")
belum <- paket[!vapply(paket, requireNamespace, logical(1), quietly = TRUE)]
if (length(belum) > 0) install.packages(belum)
library(GWmodel) # GWR dan diagnosis kolinearitas lokal
library(sp) # objek spasial (SpatialPointsDataFrame)
library(car) # VIF global
library(spdep) # bobot spasial, Moran's I, LISA
library(sf) # data vektor (polygon county)
library(dplyr) # manipulasi data
library(ggplot2) # grafik dasar
library(leaflet) # peta interaktif
library(plotly) # grafik interaktif
library(DT) # tabel interaktif
library(kableExtra) # tabel statis yang rapi
library(htmltools)
# Palet warna laporan (tema biru) -----------------------------------------------
biru <- c(tua = "#0b2a4a", utama = "#1f5fa8", muda = "#5b9bd5", pucat = "#eef5fc")
# Fungsi bantu ------------------------------------------------------------------
# format angka gaya Indonesia (koma desimal)
fmt <- function(x, d = 2) formatC(x, format = "f", digits = d, decimal.mark = ",", big.mark = ".")
# tabel statis bertema biru
tabel <- function(df, caption, full = FALSE, align = NULL, ...) {
kbl(df, caption = caption, align = align, escape = FALSE,
format.args = list(decimal.mark = ",", big.mark = "."), ...) |>
kable_styling(bootstrap_options = c("striped", "hover", "condensed"),
full_width = full, position = "center")
}
# tabel interaktif (DT) berbahasa Indonesia
bahasa_dt <- list(
search = "Cari:", lengthMenu = "Tampilkan _MENU_ baris",
info = "Menampilkan _START_โ_END_ dari _TOTAL_ baris", infoEmpty = "Tidak ada data",
infoFiltered = "(disaring dari _MAX_ baris)", zeroRecords = "Data tidak ditemukan",
paginate = list(first = "Awal", last = "Akhir", `next` = "โบ", previous = "โน")
)
tabel_dt <- function(df, caption, page = 10, ...) {
datatable(
df, rownames = FALSE, caption = caption, filter = "top",
extensions = c("Buttons", "FixedHeader"),
options = list(pageLength = page, lengthMenu = c(10, 25, 50, 159),
scrollX = TRUE, dom = "Bfrtip", fixedHeader = TRUE,
buttons = c("copy", "csv", "excel"), language = bahasa_dt,
columnDefs = list(list(className = "dt-center", targets = "_all"))),
...
)
}
# kartu ringkasan (KPI)
kartu <- function(nilai, label) {
div(class = "kpi", lapply(seq_along(nilai), function(i)
div(class = "k", div(class = "v", HTML(nilai[i])), div(class = "l", HTML(label[i])))))
}# Membaca dataset Georgia (GeoDa) -------------------------------------------------
# Versi interaktif pada RStudio: geo <- read.csv(file.choose())
# Untuk knit, file CSV dibaca langsung dari folder kerja.
kandidat <- c("Georgia.csv", "georgia.csv", "GData_utm.csv", "georgia_utm.csv",
list.files(pattern = "(?i)georgia.*\\.csv$"))
data_file <- kandidat[file.exists(kandidat)][1]
if (is.na(data_file)) {
# file CSV tidak ada di folder kerja: pakai data yang sudah ditanam di .Rmd
data_file <- tempfile(fileext = ".csv")
writeLines(data_csv, data_file)
}
geo <- read.csv(data_file)
# Variabel penelitian
vars_x <- c("PctBach", "PctRural", "PctEld")
vars <- c("PctPov", vars_x)
f <- PctPov ~ PctBach + PctRural + PctEld
kolom_wajib <- c(vars, "X", "Y", "AreaKey")
kolom_hilang <- setdiff(kolom_wajib, names(geo))
if (length(kolom_hilang) > 0) stop("Kolom tidak ditemukan: ", paste(kolom_hilang, collapse = ", "))
str(geo)#> 'data.frame': 159 obs. of 13 variables:
#> $ AreaKey : int 13001 13003 13005 13007 13009 13011 13013 13015 13017 13019 ...
#> $ Latitude: num 31.8 31.3 31.6 31.3 33.1 ...
#> $ Longitud: num -82.3 -82.9 -82.5 -84.5 -83.3 ...
#> $ TotPop90: int 15744 6213 9566 3615 39530 10308 29721 55911 16245 14153 ...
#> $ PctRural: num 75.6 100 61.7 100 42.7 100 64.6 75.2 47 66.2 ...
#> $ PctBach : num 8.2 6.4 6.6 9.4 13.3 6.4 9.2 9 7.6 7.5 ...
#> $ PctEld : num 11.43 11.77 11.11 13.17 8.64 ...
#> $ PctFB : num 0.64 1.58 0.27 0.11 1.43 0.34 0.92 0.82 0.33 1.19 ...
#> $ PctPov : num 19.9 26 24.1 24.8 17.5 15.1 14.7 10.7 22 19.3 ...
#> $ PctBlack: num 20.8 26.9 15.4 51.7 42.4 ...
#> $ ID : int 133 158 146 155 79 23 33 24 138 153 ...
#> $ X : num 941397 895553 930946 745399 849431 ...
#> $ Y : int 3521764 3471916 3502787 3474765 3665553 3807616 3769623 3793408 3520432 3466377 ...
# Batas wilayah county Georgia ---------------------------------------------------
# Sumber utama: TIGER/Line (tigris). Cadangan: shapefile GeoDa (G_utm.shp) bila tersedia.
nama_fips <- "13001=Appling;13003=Atkinson;13005=Bacon;13007=Baker;13009=Baldwin;13011=Banks;13013=Barrow;13015=Bartow;13017=Ben Hill;13019=Berrien;13021=Bibb;13023=Bleckley;13025=Brantley;13027=Brooks;13029=Bryan;13031=Bulloch;13033=Burke;13035=Butts;13037=Calhoun;13039=Camden;13043=Candler;13045=Carroll;13047=Catoosa;13049=Charlton;13051=Chatham;13053=Chattahoochee;13055=Chattooga;13057=Cherokee;13059=Clarke;13061=Clay;13063=Clayton;13065=Clinch;13067=Cobb;13069=Coffee;13071=Colquitt;13073=Columbia;13075=Cook;13077=Coweta;13079=Crawford;13081=Crisp;13083=Dade;13085=Dawson;13087=Decatur;13089=DeKalb;13091=Dodge;13093=Dooly;13095=Dougherty;13097=Douglas;13099=Early;13101=Echols;13103=Effingham;13105=Elbert;13107=Emanuel;13109=Evans;13111=Fannin;13113=Fayette;13115=Floyd;13117=Forsyth;13119=Franklin;13121=Fulton;13123=Gilmer;13125=Glascock;13127=Glynn;13129=Gordon;13131=Grady;13133=Greene;13135=Gwinnett;13137=Habersham;13139=Hall;13141=Hancock;13143=Haralson;13145=Harris;13147=Hart;13149=Heard;13151=Henry;13153=Houston;13155=Irwin;13157=Jackson;13159=Jasper;13161=Jeff Davis;13163=Jefferson;13165=Jenkins;13167=Johnson;13169=Jones;13171=Lamar;13173=Lanier;13175=Laurens;13177=Lee;13179=Liberty;13181=Lincoln;13183=Long;13185=Lowndes;13187=Lumpkin;13189=McDuffie;13191=McIntosh;13193=Macon;13195=Madison;13197=Marion;13199=Meriwether;13201=Miller;13205=Mitchell;13207=Monroe;13209=Montgomery;13211=Morgan;13213=Murray;13215=Muscogee;13217=Newton;13219=Oconee;13221=Oglethorpe;13223=Paulding;13225=Peach;13227=Pickens;13229=Pierce;13231=Pike;13233=Polk;13235=Pulaski;13237=Putnam;13239=Quitman;13241=Rabun;13243=Randolph;13245=Richmond;13247=Rockdale;13249=Schley;13251=Screven;13253=Seminole;13255=Spalding;13257=Stephens;13259=Stewart;13261=Sumter;13263=Talbot;13265=Taliaferro;13267=Tattnall;13269=Taylor;13271=Telfair;13273=Terrell;13275=Thomas;13277=Tift;13279=Toombs;13281=Towns;13283=Treutlen;13285=Troup;13287=Turner;13289=Twiggs;13291=Union;13293=Upson;13295=Walker;13297=Walton;13299=Ware;13301=Warren;13303=Washington;13305=Wayne;13307=Webster;13309=Wheeler;13311=White;13313=Whitfield;13315=Wilcox;13317=Wilkes;13319=Wilkinson;13321=Worth"
ambil_batas <- function() {
batas <- NULL
if (requireNamespace("tigris", quietly = TRUE)) {
options(tigris_use_cache = TRUE)
batas <- tryCatch(
tigris::counties(state = "GA", cb = TRUE, year = 2023, class = "sf", progress_bar = FALSE),
error = function(e) NULL)
if (!is.null(batas)) batas <- batas[, c("GEOID", "NAME")]
}
if (is.null(batas)) {
shp <- c("G_utm.shp", list.files(pattern = "(?i)georgia.*\\.shp$"))
shp <- shp[file.exists(shp)][1]
if (is.na(shp)) stop("Batas county tidak tersedia: tigris gagal dan shapefile Georgia tidak ditemukan.")
batas <- st_read(shp, quiet = TRUE)
if (is.na(st_crs(batas))) st_crs(batas) <- 26917 # UTM zona 17N
kol_id <- intersect(c("AreaKey", "AREAKEY", "GEOID", "FIPS"), names(batas))[1]
kol_nm <- intersect(c("Name", "NAME", "County", "COUNTY"), names(batas))[1]
# nama county berdasarkan kode FIPS (shapefile GeoDa tidak memuat nama county)
fips <- strsplit(strsplit(nama_fips, ";")[[1]], "=")
fips <- setNames(vapply(fips, `[`, "", 2), vapply(fips, `[`, "", 1))
geoid <- sprintf("%05d", as.integer(batas[[kol_id]]))
batas <- data.frame(GEOID = geoid,
NAME = if (is.na(kol_nm)) unname(fips[geoid]) else as.character(batas[[kol_nm]]),
geometry = st_geometry(batas)) |> st_as_sf()
}
# sederhanakan geometri agar file HTML tetap ringan
batas |>
st_transform(26917) |>
st_simplify(preserveTopology = TRUE, dTolerance = 250) |>
st_transform(4326)
}
georgia_map <- ambil_batas()
geo$AreaKey_chr <- sprintf("%05d", as.integer(geo$AreaKey))
geo$County <- georgia_map$NAME[match(geo$AreaKey_chr, georgia_map$GEOID)]
nrow(georgia_map)#> [1] 159
audit <- data.frame(
Aspek = c("Dimensi dataset",
"Nilai hilang (PctPov, PctBach, PctRural, PctEld, X, Y)",
"Duplikasi AreaKey",
"Duplikasi koordinat (X, Y)",
"Koordinat tidak lengkap",
"County yang berhasil digabung dengan batas wilayah"),
Hasil = c(paste(nrow(geo), "observasi ร", sum(names(geo) %in% names(read.csv(data_file, nrows = 1))), "variabel"),
ifelse(sum(is.na(geo[, c(vars, "X", "Y")])) == 0, "0 pada seluruh kolom",
paste(sum(is.na(geo[, c(vars, "X", "Y")])), "nilai hilang")),
sum(duplicated(geo$AreaKey)),
sum(duplicated(geo[, c("X", "Y")])),
sum(!complete.cases(geo[, c("X", "Y")])),
paste(sum(!is.na(geo$County)), "dari", nrow(geo),
paste0("(", sum(is.na(geo$County)), " tanpa data)")))
)
tabel(audit, "Tabel 3. Hasil pemeriksaan kualitas data", full = TRUE) |>
column_spec(1, bold = TRUE) |> column_spec(2, color = biru["utama"], bold = TRUE)| Aspek | Hasil |
|---|---|
| Dimensi dataset | 159 observasi ร 13 variabel |
| Nilai hilang (PctPov, PctBach, PctRural, PctEld, X, Y) | 0 pada seluruh kolom |
| Duplikasi AreaKey | 0 |
| Duplikasi koordinat (X, Y) | 0 |
| Koordinat tidak lengkap | 0 |
| County yang berhasil digabung dengan batas wilayah | 159 dari 159 (0 tanpa data) |
if (anyNA(geo[, c(vars, "X", "Y", "AreaKey")])) stop("Masih terdapat missing value pada kolom analisis.")
rentang <- sapply(geo[, vars], range)
rownames(rentang) <- c("Minimum", "Maksimum")
# Mengubah data menjadi objek spasial berdasarkan koordinat X dan Y
coordinates(geo) <- ~ X + YSeluruh 159 county memiliki data lengkap tanpa duplikasi sehingga dapat langsung dianalisis tanpa imputasi maupun penghapusan observasi.
deskriptif <- t(sapply(geo@data[, vars], function(x)
c(`Rata-rata` = mean(x), `Simp. baku` = sd(x), Minimum = min(x),
Median = median(x), Maksimum = max(x))))
tabel(round(deskriptif, 2), "Tabel 4. Statistik deskriptif variabel penelitian (n = 159)",
align = rep("c", 5)) |>
column_spec(1, bold = TRUE, color = biru["tua"])| Rata-rata | Simp. baku | Minimum | Median | Maksimum | |
|---|---|---|---|---|---|
| PctPov | 19,34 | 7,25 | 2,60 | 18,60 | 35,90 |
| PctBach | 10,95 | 5,70 | 4,20 | 9,40 | 37,50 |
| PctRural | 70,18 | 27,10 | 2,50 | 72,30 | 100,00 |
| PctEld | 11,74 | 3,08 | 1,46 | 12,07 | 22,96 |
Tabel 4 menunjukkan bahwa rata-rata persentase penduduk miskin di Georgia adalah 19,34%, dengan rentang yang lebar dari 2,60% hingga 35,90%. Rata-rata lulusan sarjana hanya 10,95%, sedangkan rata-rata penduduk pedesaan mencapai 70,18%, yang menandakan bahwa sebagian besar county di Georgia bercirikan pedesaan. Persentase penduduk lansia relatif seragam (simpangan baku 3,08) dibandingkan variabel lainnya.
dist_long <- tidyr::pivot_longer(geo@data[, vars], everything(), names_to = "Variabel", values_to = "Nilai")
plot_ly(dist_long, x = ~Variabel, y = ~Nilai, type = "box", color = ~Variabel,
colors = c("#0b2a4a", "#1f5fa8", "#5b9bd5", "#9cc3ea"),
boxpoints = "all", jitter = 0.35, pointpos = 0, marker = list(size = 4, opacity = .55)) |>
layout(title = list(text = "<b>Sebaran nilai variabel penelitian (%)</b>", x = 0.02),
showlegend = FALSE, yaxis = list(title = "Persen (%)"), xaxis = list(title = ""),
font = list(family = "Plus Jakarta Sans")) |>
config(displaylogo = FALSE)# Fungsi peta choropleth interaktif ---------------------------------------------
peta <- function(data, nilai, judul, palet = "Blues", d = 2, reverse = FALSE,
tengah0 = FALSE, label_extra = NULL) {
x <- data[[nilai]]
if (tengah0) {
m <- max(abs(x), na.rm = TRUE)
pal <- colorNumeric(palet, domain = c(-m, m), reverse = reverse)
} else {
pal <- colorNumeric(palet, domain = x, reverse = reverse)
}
lab <- sprintf("<b>%s</b><br/>%s: <b>%s</b>%s", data$NAME, judul, fmt(x, d),
if (is.null(label_extra)) "" else label_extra) |> lapply(HTML)
leaflet(data, options = leafletOptions(zoomSnap = 0.25)) |>
addProviderTiles(providers$CartoDB.Positron) |>
addPolygons(fillColor = ~pal(x), fillOpacity = 0.85, color = "white", weight = 0.8,
label = lab,
highlightOptions = highlightOptions(weight = 2.5, color = biru["tua"], bringToFront = TRUE),
labelOptions = labelOptions(textsize = "13px", direction = "auto")) |>
addLegend(pal = pal, values = if (tengah0) c(-max(abs(x)), max(abs(x))) else x,
title = judul, opacity = 0.9, position = "bottomright",
labFormat = labelFormat(digits = d)) |>
addScaleBar(position = "bottomleft")
}map_awal <- left_join(georgia_map, geo@data, by = c("GEOID" = "AreaKey_chr"))
peta(map_awal, "PctPov", "PctPov (%)", palet = "Blues")Gambar 1. Peta sebaran persentase penduduk miskin (PctPov) di 159 county Georgia. Arahkan kursor ke wilayah untuk melihat nilainya.
# Bobot spasial K-Nearest Neighbours (k = 5), standardisasi baris
xy <- coordinates(geo)
knn_nb <- knn2nb(knearneigh(xy, k = 5))
lw <- nb2listw(knn_nb, style = "W")
moran_pctpov <- moran.test(geo$PctPov, lw)
moran_pctpov#>
#> Moran I test under randomisation
#>
#> data: geo$PctPov
#> weights: lw
#>
#> Moran I statistic standard deviate = 13, p-value <0.0000000000000002
#> alternative hypothesis: greater
#> sample estimates:
#> Moran I statistic Expectation Variance
#> 0.595856 -0.006329 0.002283
Gambar 1 memperlihatkan bahwa kemiskinan tinggi (biru tua)
terkonsentrasi di Georgia bagian barat daya, tengah, dan timur,
sedangkan kemiskinan rendah (biru muda) berada di sekitar wilayah
metropolitan Atlanta di bagian utara-tengah. Pola mengelompok ini
dikonfirmasi oleh Global Moranโs I untuk PctPov
sebesar 0,5959 (Z = 12,603; p < 2,2 ร
10โปยนโถ), jauh di atas nilai harapan -0,0063. Artinya, county
dengan tingkat kemiskinan serupa cenderung saling berdekatan, sehingga
pendekatan spasial seperti GWR relevan untuk digunakan.
cor_global <- cor(geo@data[, vars_x])
plot_ly(x = vars_x, y = vars_x, z = round(cor_global, 3), type = "heatmap",
colorscale = list(c(0, "#b2182b"), c(0.5, "#f7f7f7"), c(1, "#1f5fa8")),
zmin = -1, zmax = 1, text = fmt(cor_global, 3), texttemplate = "%{text}",
textfont = list(size = 16), hovertemplate = "%{y} โ %{x}: %{z}<extra></extra>") |>
layout(title = list(text = "<b>Matriks korelasi Pearson antarprediktor</b>", x = 0.02),
yaxis = list(autorange = "reversed"), font = list(family = "Plus Jakarta Sans")) |>
config(displaylogo = FALSE)Gambar 2. Matriks korelasi Pearson antarvariabel independen.
ols <- lm(f, data = geo@data)
vif_global <- vif(ols)
tab_kor <- data.frame(round(cor_global, 3), `VIF global` = round(vif_global, 3), check.names = FALSE)
tabel(tab_kor, "Tabel 5. Korelasi antarprediktor dan VIF global", align = rep("c", 4)) |>
column_spec(1, bold = TRUE) |>
column_spec(5, bold = TRUE, color = "white", background = biru["muda"])| PctBach | PctRural | PctEld | VIF global | |
|---|---|---|---|---|
| PctBach | 1,000 | -0,619 | -0,458 | 1,781 |
| PctRural | -0,619 | 1,000 | 0,390 | 1,659 |
| PctEld | -0,458 | 0,390 | 1,000 | 1,296 |
Berdasarkan Gambar 2 dan Tabel 5, korelasi terkuat terjadi antara
PctBach dan PctRural (r = -0,619):
county yang lebih pedesaan cenderung memiliki proporsi lulusan
sarjana yang lebih rendah. Korelasi lainnya tergolong lemah hingga
sedang. Seluruh VIF global berada pada rentang
1,296โ1,781, jauh di bawah ambang 10. Dengan demikian,
secara global tidak terdapat multikolinearitas yang serius. Namun, hasil
ini belum menjamin bahwa kondisi yang sama berlaku di setiap lokasi pada
model GWR.
s_ols <- summary(ols)
koef <- s_ols$coefficients
tab_ols <- data.frame(
Parameter = c("Intersep", vars_x),
Estimasi = fmt(koef[, 1], 5),
`Std. error` = fmt(koef[, 2], 5),
`t hitung` = fmt(koef[, 3], 3),
`p-value` = formatC(koef[, 4], format = "g", digits = 3, decimal.mark = ","),
check.names = FALSE
)
tabel(tab_ols, "Tabel 6. Estimasi parameter model OLS", align = c("l", rep("c", 4))) |>
column_spec(1, bold = TRUE)| Parameter | Estimasi | Std. error | t hitung | p-value | |
|---|---|---|---|---|---|
| (Intercept) | Intersep | 13,16744 | 3,22481 | 4,083 | 7,1e-05 |
| PctBach | PctBach | -0,37594 | 0,10794 | -3,483 | 0,000645 |
| PctRural | PctRural | -0,05604 | 0,02190 | -2,558 | 0,0115 |
| PctEld | PctEld | 1,21130 | 0,17029 | 7,113 | 3,93e-11 |
Rยฒ = 0,3745; adjusted Rยฒ = 0,3623; residual standard error = 5,792 (db = 155); F = 30,93 (db 3 dan 155; p = 1,001e-15).
Seluruh prediktor signifikan pada taraf 5%. Secara global, kenaikan 1
poin persen lulusan sarjana berkaitan dengan penurunan kemiskinan
sebesar 0,376 poin persen, kenaikan 1 poin persen penduduk pedesaan
berkaitan dengan penurunan kemiskinan sebesar 0,056 poin persen, dan
kenaikan 1 poin persen penduduk lansia berkaitan dengan kenaikan
kemiskinan sebesar 1,211 poin persen, dengan asumsi prediktor lain
tetap. Meskipun demikian, model OLS hanya menjelaskan
37,45% variasi kemiskinan, dan adanya autokorelasi
spasial pada PctPov mengindikasikan bahwa hubungan tersebut
kemungkinan tidak seragam antarwilayah.
# Bandwidth adaptif optimal berdasarkan AICc (kernel bisquare)
log_bw <- capture.output(
bw_gwr <- bw.gwr(f, data = geo, approach = "AICc", kernel = "bisquare", adaptive = TRUE)
)
iter <- regmatches(log_bw, regexec("neighbours\\): *([0-9]+) AICc value: *([0-9.]+)", log_bw))
iter <- do.call(rbind, lapply(iter[lengths(iter) == 3], function(m) as.numeric(m[2:3])))
tab_iter <- data.frame(Iterasi = seq_len(nrow(iter)), `Bandwidth (tetangga)` = iter[, 1],
AICc = fmt(iter[, 2], 4), check.names = FALSE)
tabel(tab_iter, "Tabel 7. Proses pencarian bandwidth adaptif optimal berdasarkan AICc",
align = rep("c", 3)) |>
row_spec(which(iter[, 1] == bw_gwr), bold = TRUE, color = "white", background = biru["utama"])| Iterasi | Bandwidth (tetangga) | AICc |
|---|---|---|
| 1 | 105 | 931,7000 |
| 2 | 73 | 921,8000 |
| 3 | 51 | 917,5000 |
| 4 | 40 | 918,1000 |
| 5 | 60 | 917,7000 |
| 6 | 47 | 916,1000 |
| 7 | 43 | 917,4000 |
| 8 | 48 | 916,3000 |
| 9 | 45 | 916,8000 |
| 10 | 47 | 916,1000 |
# Kurva AICc untuk berbagai banyaknya tetangga (pelengkap visual)
grid_bw <- 30:120
aicc_bw <- sapply(grid_bw, function(b)
gwr.basic(f, data = geo, bw = b, kernel = "bisquare", adaptive = TRUE)$GW.diagnostic$AICc)
plot_ly(x = grid_bw, y = aicc_bw, type = "scatter", mode = "lines+markers",
line = list(color = biru[["utama"]], width = 3),
marker = list(color = biru[["muda"]], size = 5),
hovertemplate = "Bandwidth: %{x} tetangga<br>AICc: %{y:.4f}<extra></extra>") |>
add_markers(x = bw_gwr, y = min(aicc_bw[grid_bw == bw_gwr]), inherit = FALSE,
marker = list(color = "#c0392b", size = 14, symbol = "star"),
name = "Optimal", hovertemplate = "Optimal: %{x} tetangga<extra></extra>") |>
layout(title = list(text = "<b>Kurva AICc terhadap bandwidth adaptif</b>", x = 0.02),
xaxis = list(title = "Bandwidth (banyaknya tetangga terdekat)"),
yaxis = list(title = "AICc"), showlegend = FALSE,
font = list(family = "Plus Jakarta Sans")) |>
config(displaylogo = FALSE)Pencarian bandwidth adaptif optimal dengan metode golden section menghasilkan nilai AICc minimum pada 47 tetangga terdekat (Tabel 7). Artinya, setiap estimasi lokal menggunakan 47 county terdekat (sekitar 30% dari seluruh data) dengan bobot yang menurun mengikuti kernel bisquare.
#> ***********************************************************************
#> * Package GWmodel *
#> ***********************************************************************
#> Program starts at: 2026-12-04 06:56:50.337213
#> Call:
#> gwr.basic(formula = f, data = geo, bw = bw_gwr, kernel = "bisquare",
#> adaptive = TRUE)
#>
#> Dependent (y) variable: PctPov
#> Independent variables: PctBach PctRural PctEld
#> Number of data points: 159
#> ***********************************************************************
#> * Results of Global Regression *
#> ***********************************************************************
#>
#> Call:
#> lm(formula = formula, data = data)
#>
#> Residuals:
#> Min 1Q Median 3Q Max
#> -17.090 -4.244 -0.543 4.510 19.178
#>
#> Coefficients:
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 13.1674 3.2248 4.08 0.000070981085 ***
#> PctBach -0.3759 0.1079 -3.48 0.00064 ***
#> PctRural -0.0560 0.0219 -2.56 0.01148 *
#> PctEld 1.2113 0.1703 7.11 0.000000000039 ***
#>
#> ---Significance stars
#> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#> Residual standard error: 5.79 on 155 degrees of freedom
#> Multiple R-squared: 0.374
#> Adjusted R-squared: 0.362
#> F-statistic: 30.9 on 3 and 155 DF, p-value: 0.000000000000001
#> ***Extra Diagnostic information
#> Residual sum of squares: 5200
#> Sigma(hat): 5.755
#> AIC: 1016
#> AICc: 1016
#> BIC: 897.4
#> ***********************************************************************
#> * Results of Geographically Weighted Regression *
#> ***********************************************************************
#>
#> *********************Model calibration information*********************
#> Kernel function: bisquare
#> Adaptive bandwidth: 47 (number of nearest neighbours)
#> Regression points: the same locations as observations are used.
#> Distance metric: Euclidean distance metric is used.
#>
#> ****************Summary of GWR coefficient estimates:******************
#> Min. 1st Qu. Median 3rd Qu. Max.
#> Intercept -9.143157 3.801184 7.491405 11.726374 21.17
#> PctBach -0.776678 -0.245276 -0.116462 -0.030416 0.36
#> PctRural -0.090934 -0.052639 -0.030695 -0.000975 0.04
#> PctEld 0.453047 1.002465 1.327735 1.669399 2.40
#> ************************Diagnostic information*************************
#> Number of data points: 159
#> Effective number of parameters (2trace(S) - trace(S'S)): 41.2
#> Effective degrees of freedom (n-2trace(S) + trace(S'S)): 117.8
#> AICc (GWR book, Fotheringham, et al. 2002, p. 61, eq 2.33): 916.1
#> AIC (GWR book, Fotheringham, et al. 2002,GWR p. 96, eq. 4.22): 864.8
#> BIC (GWR book, Fotheringham, et al. 2002,GWR p. 61, eq. 2.34): 834.9
#> Residual sum of squares: 1755
#> R-square value: 0.7889
#> Adjusted R-square value: 0.7144
#>
#> ***********************************************************************
#> Program stops at: 2026-12-04 06:56:50.345701
n_obs <- nrow(geo)
k_ols <- length(coef(ols)) + 1
aicc_ols <- AIC(ols) + (2 * k_ols * (k_ols + 1)) / (n_obs - k_ols - 1)
dg <- gwr_model$GW.diagnostic
rss_ols <- sum(residuals(ols)^2)
kartu(
c(fmt(s_ols$r.squared, 4), fmt(dg$gw.R2, 4), fmt(aicc_ols - dg$AICc, 2),
paste0(fmt(100 * (1 - dg$RSS.gw / rss_ols), 1), "%")),
c("R² OLS", "R² GWR", "Penurunan AICc", "Pengurangan RSS")
)perbandingan <- data.frame(
Ukuran = c("R²", "Adjusted R²", "AICc", "Jumlah kuadrat residual (RSS)",
"Jumlah parameter efektif", "Derajat bebas efektif"),
OLS = c(fmt(s_ols$r.squared, 4), fmt(s_ols$adj.r.squared, 4), fmt(aicc_ols, 2),
fmt(rss_ols, 2), "4", as.character(s_ols$df[2])),
GWR = c(fmt(dg$gw.R2, 4), fmt(dg$gwR2.adj, 4), fmt(dg$AICc, 2),
fmt(dg$RSS.gw, 2), fmt(dg$enp, 2), fmt(dg$edf, 2))
)
tabel(perbandingan, "Tabel 8. Perbandingan kinerja model OLS dan GWR", align = c("l", "c", "c")) |>
column_spec(1, bold = TRUE) |>
column_spec(3, bold = TRUE, color = biru["utama"])| Ukuran | OLS | GWR |
|---|---|---|
| Rยฒ | 0,3745 | 0,7889 |
| Adjusted Rยฒ | 0,3623 | 0,7144 |
| AICc | 1.016,12 | 916,11 |
| Jumlah kuadrat residual (RSS) | 5.199,84 | 1.755,19 |
| Jumlah parameter efektif | 4 | 41,20 |
| Derajat bebas efektif | 155 | 117,80 |
Tabel 8 menunjukkan bahwa GWR jauh lebih baik daripada OLS. Rยฒ meningkat dari 0,3745 menjadi 0,7889 dan adjusted Rยฒ dari 0,3623 menjadi 0,7144. AICc turun sebesar 100,01 poin (dari 1.016,12 menjadi 916,11), jauh melebihi batas selisih 3, dan RSS berkurang sekitar 66%. Hal ini menunjukkan bahwa hubungan antara kemiskinan dan ketiga prediktor memang bervariasi secara spasial.
coef_gwr <- gwr_model$SDF@data
ring_koef <- sapply(coef_gwr[, c("Intercept", vars_x)], function(x) c(
Minimum = min(x), `Kuartil 1` = unname(quantile(x, .25)), Median = median(x),
`Rata-rata` = mean(x), `Kuartil 3` = unname(quantile(x, .75)), Maksimum = max(x)))
sign_reversal <- sapply(vars_x, function(v) sum(sign(coef_gwr[[v]]) != sign(coef(ols)[v])))
tab_koef <- rbind(
fmt(ring_koef, 4),
`Koefisien OLS` = fmt(coef(ols), 4),
`County dengan tanda berbeda dari OLS` = c("โ", sign_reversal)
)
colnames(tab_koef) <- c("Intersep", vars_x)
tabel(tab_koef, "Tabel 9. Ringkasan koefisien lokal GWR dan jumlah county dengan tanda berbeda dari OLS",
align = rep("c", 4)) |>
column_spec(1, bold = TRUE) |>
row_spec(7:8, bold = TRUE, background = biru["pucat"])| Intersep | PctBach | PctRural | PctEld | |
|---|---|---|---|---|
| Minimum | -9,1432 | -0,7767 | -0,0909 | 0,4530 |
| Kuartil 1 | 3,8012 | -0,2453 | -0,0526 | 1,0025 |
| Median | 7,4914 | -0,1165 | -0,0307 | 1,3277 |
| Rata-rata | 7,2999 | -0,1414 | -0,0266 | 1,3223 |
| Kuartil 3 | 11,7264 | -0,0304 | -0,0010 | 1,6694 |
| Maksimum | 21,1723 | 0,3589 | 0,0374 | 2,4025 |
| Koefisien OLS | 13,1674 | -0,3759 | -0,0560 | 1,2113 |
| County dengan tanda berbeda dari OLS | โ | 28 | 39 | 0 |
Koefisien PctEld selalu positif di seluruh
county (0,453โ2,403), sehingga hubungan positif antara penduduk
lansia dan kemiskinan konsisten di seluruh Georgia, hanya kekuatannya
yang berbeda. Sebaliknya, koefisien PctBach berbalik
menjadi positif di 28 county dan koefisien
PctRural berbalik menjadi positif di 39
county. Perubahan tanda seperti ini dapat mencerminkan
kondisi lokal yang sebenarnya, tetapi juga dapat menjadi gejala
multikolinearitas lokal [3]; karena itu perlu diperiksa lebih lanjut
pada subbab 4.6โ4.9.
# Menggabungkan seluruh hasil ke polygon county
gwr_collin <- gwr.collin.diagno(f, data = geo, bw = bw_gwr, kernel = "bisquare", adaptive = TRUE)
diag_local <- gwr_collin$SDF@data
cn_local <- diag_local$local_CN
dashboard_data <- data.frame(
AreaKey_chr = geo$AreaKey_chr,
AreaKey = geo$AreaKey,
PctPov = geo$PctPov, PctBach = geo$PctBach, PctRural = geo$PctRural, PctEld = geo$PctEld,
Local_CN = cn_local,
PctBach_VIF = diag_local$PctBach_VIF,
PctRural_VIF = diag_local$PctRural_VIF,
PctEld_VIF = diag_local$PctEld_VIF,
Intercept_VDP = diag_local$Intercept_VDP,
PctBach_VDP = diag_local$PctBach_VDP,
PctRural_VDP = diag_local$PctRural_VDP,
PctEld_VDP = diag_local$PctEld_VDP,
GWR_Intercept = coef_gwr$Intercept,
GWR_PctBach = coef_gwr$PctBach,
GWR_PctRural = coef_gwr$PctRural,
GWR_PctEld = coef_gwr$PctEld,
Local_R2 = coef_gwr$Local_R2,
GWR_Residual = coef_gwr$residual
)
map_sf <- left_join(georgia_map, dashboard_data, by = c("GEOID" = "AreaKey_chr"))
map_sf$CN_Kategori <- cut(map_sf$Local_CN, breaks = c(-Inf, 20, 30, Inf), right = TRUE,
labels = c("Rendah (<20)", "Sedang (20-30)", "Tinggi (>30)"))
cat("Jumlah county tanpa data:", sum(is.na(map_sf$Local_CN)), "\n")#> Jumlah county tanpa data: 0
Gambar 3. Peta koefisien lokal GWR untuk PctBach (merah = negatif, biru = positif).
Gambar 4. Peta koefisien lokal GWR untuk PctRural (merah = negatif, biru = positif).
Gambar 3 memperlihatkan bahwa pengaruh negatif PctBach
paling kuat terdapat di sebagian wilayah barat dan timur-tengah,
sedangkan koefisien positif terkonsentrasi di Georgia bagian
tengah-timur. Gambar 4 menunjukkan koefisien PctRural
bernilai positif di bagian tenggara dan negatif di bagian barat serta
timur laut. Gambar 5 menunjukkan pengaruh PctEld paling
kuat di sekitar wilayah utara-tengah dan barat daya, serta paling lemah
di ujung utara dan pesisir tenggara.
Gambar 6. Peta local Rยฒ model GWR.
Local Rยฒ (Gambar 6) berkisar 0,42 hingga 0,96. Model bekerja paling baik di Georgia bagian barat laut dan barat, serta paling lemah di pesisir tenggara. Peta residual (Gambar 7) menunjukkan residual positif dan negatif yang bercampur di seluruh wilayah tanpa kelompok besar yang mencolok, meskipun terdapat beberapa county dengan residual besar di bagian tengah-timur.
vif_local <- diag_local[, c("PctBach_VIF", "PctRural_VIF", "PctEld_VIF")]
ring_vif <- sapply(vif_local, function(x) c(
Minimum = min(x), `Kuartil 1` = unname(quantile(x, .25)), Median = median(x),
`Rata-rata` = mean(x), `Kuartil 3` = unname(quantile(x, .75)), Maksimum = max(x)))
tab_vif <- rbind(fmt(ring_vif, 3), `Jumlah county dengan local VIF > 10` = colSums(vif_local > 10))
colnames(tab_vif) <- vars_x
tabel(tab_vif, "Tabel 10. Ringkasan local VIF untuk setiap prediktor", align = rep("c", 3)) |>
column_spec(1, bold = TRUE) |>
row_spec(7, bold = TRUE, background = biru["pucat"])| PctBach | PctRural | PctEld | |
|---|---|---|---|
| Minimum | 1,173 | 1,171 | 1,005 |
| Kuartil 1 | 1,848 | 1,622 | 1,200 |
| Median | 2,176 | 1,939 | 1,410 |
| Rata-rata | 2,248 | 1,985 | 1,464 |
| Kuartil 3 | 2,507 | 2,282 | 1,672 |
| Maksimum | 3,988 | 3,429 | 2,446 |
| Jumlah county dengan local VIF > 10 | 0 | 0 | 0 |
vif_long <- data.frame(County = rep(geo$County, 3),
Prediktor = rep(vars_x, each = nrow(vif_local)),
VIF = unlist(vif_local))
plot_ly(vif_long, x = ~Prediktor, y = ~VIF, color = ~Prediktor, type = "box",
colors = c("#0b2a4a", "#1f5fa8", "#5b9bd5"), boxpoints = "all", jitter = .35,
pointpos = 0, text = ~County, hovertemplate = "%{text}<br>VIF: %{y:.3f}<extra></extra>",
marker = list(size = 4, opacity = .6)) |>
layout(title = list(text = "<b>Distribusi local VIF (garis putus-putus = ambang 10)</b>", x = 0.02),
yaxis = list(title = "Local VIF", range = c(0, 10.8)), xaxis = list(title = ""),
shapes = list(list(type = "line", xref = "paper", x0 = 0, x1 = 1, y0 = 10, y1 = 10,
line = list(color = "#c0392b", dash = "dash", width = 2))),
showlegend = FALSE, font = list(family = "Plus Jakarta Sans")) |>
config(displaylogo = FALSE)Tabel 10 menunjukkan bahwa local VIF lebih bervariasi dan sedikit lebih tinggi daripada VIF global, tetapi seluruh nilainya masih jauh di bawah 10. Nilai tertinggi adalah 3,988 untuk PctBach di county 13303 (Washington). Berdasarkan local VIF, tidak ada county yang terindikasi multikolinearitas serius di antara ketiga prediktor.
Gambar 8. Peta local VIF untuk PctBach.
Gambar 9. Peta local VIF untuk PctRural.
Gambar 8 hingga 10 menunjukkan bahwa local VIF
PctBach dan PctRural tertinggi berada di
koridor tengah Georgia, sedangkan local VIF PctEld
tertinggi berada di bagian timur (sekitar Burke dan Jefferson) serta
barat daya. Pola ini menunjukkan bahwa kekuatan hubungan antarprediktor
memang berbeda antarwilayah, walaupun belum mencapai tingkat yang
berbahaya menurut kriteria VIF.
kat_cn <- cut(cn_local, c(-Inf, 20, 30, Inf), labels = c("Rendah (< 20)", "Sedang (20โ30)", "Tinggi (> 30)"))
ring_cn <- summary(cn_local)
frek <- table(kat_cn)
kartu(c(fmt(min(cn_local)), fmt(mean(cn_local)), fmt(max(cn_local)), sum(cn_local > 30)),
c("CN minimum", "CN rata-rata", "CN maksimum", "County CN > 30"))tab_cn <- data.frame(
Statistik = c("Minimum", "Kuartil 1", "Median", "Rata-rata", "Kuartil 3", "Maksimum"),
Nilai = fmt(as.numeric(ring_cn), 2),
Kategori = c(names(frek), "Total", "", ""),
`Jumlah county` = c(as.integer(frek), sum(frek), "", ""),
Persentase = c(paste0(fmt(100 * as.numeric(frek) / sum(frek), 1), "%"), "100%", "", ""),
check.names = FALSE
)
tabel(tab_cn, "Tabel 11. Ringkasan local condition number dan pengelompokannya", align = rep("c", 5)) |>
column_spec(1, bold = TRUE) |>
column_spec(3, bold = TRUE, color = biru["utama"])| Statistik | Nilai | Kategori | Jumlah county | Persentase |
|---|---|---|---|---|
| Minimum | 13,34 | Rendah (< 20) | 62 | 39,0% |
| Kuartil 1 | 18,22 | Sedang (20โ30) | 84 | 52,8% |
| Median | 21,74 | Tinggi (> 30) | 13 | 8,2% |
| Rata-rata | 22,35 | Total | 159 | 100% |
| Kuartil 3 | 26,09 | |||
| Maksimum | 40,88 |
Berbeda dengan local VIF, local CN mengindikasikan adanya kolinearitas lokal. Local CN berkisar 13,34โ40,88 dengan rata-rata 22,35. Sebanyak 13 county (8,2%) memiliki local CN > 30, 84 county (52,8%) berada pada kategori sedang, dan 62 county (39,0%) berada pada kategori rendah.
pal_cn <- colorFactor(c("#cfe0f3", "#f4a259", "#c0392b"), levels = levels(map_sf$CN_Kategori))
leaflet(map_sf) |>
addProviderTiles(providers$CartoDB.Positron) |>
addPolygons(fillColor = ~pal_cn(CN_Kategori), fillOpacity = .85, color = "white", weight = .8,
label = ~lapply(sprintf("<b>%s</b><br/>Local CN: <b>%s</b><br/>%s", NAME, fmt(Local_CN), CN_Kategori), HTML),
highlightOptions = highlightOptions(weight = 2.5, color = biru[["tua"]], bringToFront = TRUE)) |>
addLegend(pal = pal_cn, values = ~CN_Kategori, title = "Local CN", position = "bottomright", opacity = .9)Gambar 12. Peta kategori local condition number.
plot_ly(data.frame(xy, CN = cn_local, Kat = kat_cn, County = geo$County),
x = ~X, y = ~Y, color = ~Kat, colors = c("#9fb7d1", "#f4a259", "#c0392b"),
type = "scatter", mode = "markers", marker = list(size = 11, line = list(color = "white", width = 1)),
text = ~County, hovertemplate = "%{text}<br>CN: %{customdata:.2f}<extra></extra>",
customdata = ~CN) |>
layout(title = list(text = "<b>Sebaran titik local CN berdasarkan koordinat</b>", x = 0.02),
xaxis = list(title = "X (UTM)"), yaxis = list(title = "Y (UTM)", scaleanchor = "x"),
legend = list(title = list(text = "<b>Local CN</b>")), font = list(family = "Plus Jakarta Sans")) |>
config(displaylogo = FALSE)Gambar 13. Sebaran titik local condition number berdasarkan koordinat.
plot_ly(x = cn_local, type = "histogram", nbinsx = 28,
marker = list(color = biru[["utama"]], line = list(color = "white", width = 1))) |>
layout(title = list(text = "<b>Histogram local CN</b>", x = 0.02),
xaxis = list(title = "Local CN"), yaxis = list(title = "Banyaknya county"),
shapes = list(
list(type = "line", x0 = 20, x1 = 20, yref = "paper", y0 = 0, y1 = 1, line = list(color = "#f4a259", dash = "dash")),
list(type = "line", x0 = 30, x1 = 30, yref = "paper", y0 = 0, y1 = 1, line = list(color = "#c0392b", dash = "dash"))),
font = list(family = "Plus Jakarta Sans")) |>
config(displaylogo = FALSE)Gambar 12 dan 13 menunjukkan bahwa county dengan CN tinggi membentuk dua kelompok: (1) kelompok tengah-timur yang meliputi Johnson, Washington, Emanuel, Treutlen, Jefferson, Wilkinson, Laurens, Burke, dan Twiggs; serta (2) kelompok perbatasan selatan yang meliputi Lowndes, Cook, Lanier, dan Echols. County dengan CN rendah berada di Georgia bagian utara dan pesisir tenggara.
vdp_cols <- c("Intercept_VDP", "PctBach_VDP", "PctRural_VDP", "PctEld_VDP")
hasil <- data.frame(
Kode = geo$AreaKey, County = geo$County, `Local CN` = cn_local,
`VIF Bach` = vif_local$PctBach_VIF, `VIF Rural` = vif_local$PctRural_VIF, `VIF Eld` = vif_local$PctEld_VIF,
diag_local[, vdp_cols], check.names = FALSE
)
hasil_cn30 <- hasil[hasil$`Local CN` > 30, ]
hasil_cn30 <- hasil_cn30[order(hasil_cn30$`Local CN`, decreasing = TRUE), ]
jml_vdp <- colSums(hasil_cn30[, vdp_cols] > 0.5)
tampil <- hasil_cn30
tampil$`Local CN` <- fmt(tampil$`Local CN`, 2)
for (v in c("VIF Bach", "VIF Rural", "VIF Eld")) tampil[[v]] <- fmt(tampil[[v]], 2)
for (v in vdp_cols) {
x <- hasil_cn30[[v]]
tampil[[v]] <- cell_spec(fmt(x, 3), bold = x > 0.5,
color = ifelse(x > 0.5, "white", "#16263d"),
background = ifelse(x > 0.5, "#1f5fa8", "transparent"))
}
names(tampil)[7:10] <- c("VDP Int.", "VDP Bach", "VDP Rural", "VDP Eld")
tampil <- rbind(tampil, c("", "<b>Jumlah VDP > 0,5</b>", "", "", "", "", paste0("<b>", jml_vdp, "</b>")))
tabel(tampil, "Tabel 12. County dengan local CN > 30 beserta local VIF dan VDP",
align = c("c", "l", rep("c", 8)), row.names = FALSE) |>
add_header_above(c(" " = 3, "Local VIF" = 3, "Variance Decomposition Proportion" = 4),
background = biru["tua"], color = "white") |>
column_spec(3, bold = TRUE, color = "#c0392b") |>
row_spec(nrow(tampil), background = biru["pucat"]) |>
scroll_box(width = "100%")| Kode | County | Local CN | VIF Bach | VIF Rural | VIF Eld | VDP Int. | VDP Bach | VDP Rural | VDP Eld |
|---|---|---|---|---|---|---|---|---|---|
| 13167 | Johnson | 40,88 | 2,79 | 1,86 | 1,75 | 0,994 | 0,704 | 0,323 | 0,875 |
| 13303 | Washington | 39,35 | 3,99 | 2,64 | 1,94 | 0,999 | 0,854 | 0,544 | 0,726 |
| 13107 | Emanuel | 36,77 | 2,13 | 1,46 | 1,61 | 0,991 | 0,675 | 0,156 | 0,918 |
| 13283 | Treutlen | 36,20 | 1,59 | 1,27 | 1,32 | 0,987 | 0,527 | 0,091 | 0,904 |
| 13163 | Jefferson | 34,01 | 3,75 | 2,18 | 2,41 | 0,996 | 0,867 | 0,348 | 0,774 |
| 13319 | Wilkinson | 33,39 | 3,71 | 3,11 | 1,36 | 1,000 | 0,836 | 0,684 | 0,529 |
| 13185 | Lowndes | 32,21 | 1,89 | 1,88 | 1,12 | 0,998 | 0,603 | 0,664 | 0,719 |
| 13075 | Cook | 30,95 | 1,72 | 1,57 | 1,13 | 0,996 | 0,591 | 0,490 | 0,750 |
| 13173 | Lanier | 30,66 | 1,79 | 1,77 | 1,09 | 0,998 | 0,568 | 0,619 | 0,702 |
| 13175 | Laurens | 30,58 | 2,16 | 1,78 | 1,32 | 0,993 | 0,628 | 0,280 | 0,734 |
| 13033 | Burke | 30,33 | 3,45 | 2,09 | 2,21 | 0,994 | 0,845 | 0,226 | 0,823 |
| 13289 | Twiggs | 30,06 | 3,62 | 3,33 | 1,16 | 0,999 | 0,815 | 0,736 | 0,415 |
| 13101 | Echols | 30,03 | 2,16 | 2,19 | 1,11 | 0,999 | 0,627 | 0,726 | 0,632 |
| Jumlah VDP > 0,5 | 13 | 13 | 6 | 12 |
Keterangan: sel biru menandakan VDP > 0,5. Nama county
ditentukan dari kode FIPS (AreaKey).
m_vdp <- as.matrix(hasil_cn30[, vdp_cols])
plot_ly(x = c("Intersep", vars_x), y = hasil_cn30$County, z = m_vdp, type = "heatmap",
colorscale = list(c(0, "#f3f8fd"), c(0.5, "#9cc3ea"), c(1, "#0b2a4a")), zmin = 0, zmax = 1,
text = fmt(m_vdp, 3), texttemplate = "%{text}",
hovertemplate = "%{y} ยท %{x}<br>VDP: %{z:.3f}<extra></extra>") |>
layout(title = list(text = "<b>Heatmap VDP pada county dengan CN > 30</b>", x = 0.02),
yaxis = list(autorange = "reversed", title = ""), xaxis = list(title = ""),
font = list(family = "Plus Jakarta Sans")) |>
config(displaylogo = FALSE)Tabel 12 memperlihatkan tiga temuan penting.
Pertama, seluruh 13 county tersebut memiliki
local VIF di bawah 4, sehingga local VIF saja tidak
akan mendeteksi masalah ini. Kedua, VDP intersep
bernilai 0,987โ1,000 di seluruh 13 county, VDP
PctBach > 0,5 di 13 county, VDP
PctEld > 0,5 di 12 county, dan VDP
PctRural > 0,5 di 6 county. Artinya,
ketergantungan linier yang terdeteksi terutama melibatkan intersep,
PctBach, dan PctEld. Ketiga,
hal ini menjelaskan mengapa local CN mendeteksi masalah
sementara local VIF tidak: local VIF hanya mengukur
hubungan antarprediktor, sedangkan local CN juga
memperhitungkan intersep [4].
Keterlibatan intersep berarti bahwa di sekitar
county-county tersebut nilai PctBach dan
PctEld relatif seragam di antara 47 tetangganya sehingga
kolom prediktor hampir sebanding dengan kolom konstanta. Akibatnya,
model sulit memisahkan pengaruh PctBach dan
PctEld dari intersep, dan estimasi ketiga koefisien
tersebut menjadi kurang stabil.
#>
#> Moran I test under randomisation
#>
#> data: cn_local
#> weights: lw
#>
#> Moran I statistic standard deviate = 17, p-value <0.0000000000000002
#> alternative hypothesis: greater
#> sample estimates:
#> Moran I statistic Expectation Variance
#> 0.815599 -0.006329 0.002265
lisa_cn <- localmoran(cn_local, lw)
cn_centered <- cn_local - mean(cn_local)
lag_cn <- lag.listw(lw, cn_centered)
pola_lisa <- ifelse(cn_centered >= 0 & lag_cn >= 0, "High-High",
ifelse(cn_centered < 0 & lag_cn < 0, "Low-Low",
ifelse(cn_centered >= 0 & lag_cn < 0, "High-Low", "Low-High")))
kolom_p <- grep("^Pr", colnames(lisa_cn), value = TRUE)[1]
hasil_lisa <- data.frame(
AreaKey = geo$AreaKey, County = geo$County,
Local_CN = round(cn_local, 3), Spatial_Lag_CN = round(lag_cn, 3),
Local_Moran_I = round(lisa_cn[, "Ii"], 4), Pola = pola_lisa,
P_Value = signif(lisa_cn[, kolom_p], 4)
)
hasil_lisa$Status <- ifelse(hasil_lisa$P_Value < 0.05, "Signifikan", "Tidak signifikan")Global Moranโs I untuk local CN sebesar
0,8156 (Z = 17,27; p < 2,2 ร 10โปยนโถ), lebih
besar daripada Moranโs I untuk PctPov. Hal ini
wajar karena county yang berdekatan berbagi banyak tetangga
yang sama dalam estimasi GWR, sehingga kondisi kolinearitas lokalnya
juga mirip. Hasil LISA disajikan pada Tabel 13 dan Gambar 14.
tab_lisa <- table(factor(hasil_lisa$Pola, levels = c("High-High", "Low-Low", "High-Low", "Low-High")),
factor(hasil_lisa$Status, levels = c("Signifikan", "Tidak signifikan")))
tab_lisa <- addmargins(tab_lisa)
dimnames(tab_lisa) <- list(Pola = c("High-High", "Low-Low", "High-Low", "Low-High", "Total"),
c("Signifikan (p < 0,05)", "Tidak signifikan", "Total"))
tabel(as.data.frame.matrix(tab_lisa), "Tabel 13. Ringkasan klasifikasi LISA untuk local CN",
align = rep("c", 3)) |>
column_spec(1, bold = TRUE) |>
row_spec(5, bold = TRUE, background = biru["pucat"])| Signifikan (p < 0,05) | Tidak signifikan | Total | |
|---|---|---|---|
| High-High | 29 | 35 | 64 |
| Low-Low | 28 | 52 | 80 |
| High-Low | 0 | 4 | 4 |
| Low-High | 0 | 11 | 11 |
| Total | 57 | 102 | 159 |
map_sf$LISA_Pola <- hasil_lisa$Pola[match(map_sf$GEOID, sprintf("%05d", hasil_lisa$AreaKey))]
map_sf$LISA_Sig <- hasil_lisa$Status[match(map_sf$GEOID, sprintf("%05d", hasil_lisa$AreaKey))]
map_sf$LISA_Peta <- ifelse(map_sf$LISA_Sig == "Signifikan", map_sf$LISA_Pola, "Tidak signifikan")
map_sf$LISA_Peta <- factor(map_sf$LISA_Peta, levels = c("High-High", "Low-Low", "High-Low", "Low-High", "Tidak signifikan"))
pal_lisa <- colorFactor(c("#c0392b", "#1f5fa8", "#f4a259", "#9cc3ea", "#e9edf2"), levels = levels(map_sf$LISA_Peta))
leaflet(map_sf) |>
addProviderTiles(providers$CartoDB.Positron) |>
addPolygons(fillColor = ~pal_lisa(LISA_Peta), fillOpacity = .85, color = "white", weight = .8,
label = ~lapply(sprintf("<b>%s</b><br/>Pola: %s<br/>Local CN: %s<br/>%s",
NAME, LISA_Pola, fmt(Local_CN), LISA_Sig), HTML),
highlightOptions = highlightOptions(weight = 2.5, color = biru[["tua"]], bringToFront = TRUE)) |>
addLegend(pal = pal_lisa, values = ~LISA_Peta, title = "Klaster LISA (p < 0,05)",
position = "bottomright", opacity = .9)Gambar 14. Peta klasifikasi LISA untuk local condition number (hanya klaster signifikan yang diberi warna).
tabel_dt(
hasil_lisa |> arrange(desc(Local_Moran_I)),
caption = "Tabel hasil LISA untuk seluruh county (urut Local Moran's I tertinggi)"
) |>
formatStyle("Status", color = styleEqual(c("Signifikan", "Tidak signifikan"), c("#1f5fa8", "#8a97a8")),
fontWeight = styleEqual("Signifikan", "bold")) |>
formatStyle("Pola", backgroundColor = styleEqual(c("High-High", "Low-Low", "High-Low", "Low-High"),
c("#f8d7d3", "#dbe8f7", "#fde6cf", "#eef5fc")))Sebanyak 29 county termasuk klaster High-High signifikan dan 28 county termasuk klaster Low-Low signifikan. Seluruh 13 county dengan CN > 30 termasuk klaster High-High yang signifikan, dengan nilai LISA tertinggi pada Johnson (\(I_i\) = 8,571; p = 5,78 ร 10โ9) dan Washington (\(I_i\) = 5,429; p = 6,19 ร 10โ5). Klaster Low-Low signifikan berada di Georgia bagian utara (sekitar Atlanta) dan pesisir tenggara. Dengan demikian, kolinearitas lokal tidak muncul secara acak, melainkan membentuk zona geografis yang jelas.
bw_coba <- unique(c(bw_gwr, 60, 80, 100, 159))
sens <- t(sapply(bw_coba, function(b) {
cn <- gwr.collin.diagno(f, data = geo, bw = b, kernel = "bisquare", adaptive = TRUE)$SDF$local_CN
c(Bandwidth = b, CN_Min = min(cn), CN_Mean = mean(cn), CN_Max = max(cn), CN30 = sum(cn > 30))
}))
tab_sens <- data.frame(
`Bandwidth (tetangga)` = ifelse(sens[, 1] == bw_gwr, paste0(sens[, 1], " (optimal)"),
ifelse(sens[, 1] == nrow(geo), paste0(sens[, 1], " (seluruh data)"), sens[, 1])),
`CN minimum` = fmt(sens[, 2]), `CN rata-rata` = fmt(sens[, 3]), `CN maksimum` = fmt(sens[, 4]),
`County dengan CN > 30` = sens[, 5], check.names = FALSE
)
tabel(tab_sens, "Tabel 14. Hasil uji sensitivitas local CN terhadap bandwidth", align = rep("c", 5)) |>
row_spec(1, bold = TRUE, color = "white", background = biru["utama"])| Bandwidth (tetangga) | CN minimum | CN rata-rata | CN maksimum | County dengan CN > 30 |
|---|---|---|---|---|
| 47 (optimal) | 13,34 | 22,35 | 40,88 | 13 |
| 60 | 14,19 | 20,91 | 34,13 | 4 |
| 80 | 13,73 | 19,66 | 29,58 | 0 |
| 100 | 13,74 | 18,93 | 26,77 | 0 |
| 159 (seluruh data) | 14,32 | 17,07 | 19,21 | 0 |
sens_df <- as.data.frame(sens)
plot_ly(sens_df, x = ~Bandwidth) |>
add_ribbons(ymin = ~CN_Min, ymax = ~CN_Max, name = "Rentang CN",
fillcolor = "rgba(91,155,213,0.25)", line = list(color = "transparent")) |>
add_lines(y = ~CN_Mean, name = "CN rata-rata", line = list(color = biru[["utama"]], width = 3)) |>
add_lines(y = ~CN_Max, name = "CN maksimum", line = list(color = "#c0392b", width = 2, dash = "dot")) |>
add_markers(y = ~CN_Max, showlegend = FALSE, marker = list(color = "#c0392b", size = 9),
text = ~paste0(CN30, " county CN > 30"), hovertemplate = "bw %{x}: %{y:.2f}<br>%{text}<extra></extra>") |>
layout(title = list(text = "<b>Local CN menurun saat bandwidth diperbesar</b>", x = 0.02),
xaxis = list(title = "Bandwidth (tetangga)"), yaxis = list(title = "Local CN"),
shapes = list(list(type = "line", xref = "paper", x0 = 0, x1 = 1, y0 = 30, y1 = 30,
line = list(color = "#8a97a8", dash = "dash"))),
legend = list(orientation = "h", y = -0.25), font = list(family = "Plus Jakarta Sans")) |>
config(displaylogo = FALSE)Tabel 14 menunjukkan bahwa local CN sangat bergantung pada bandwidth. Semakin besar bandwidth, semakin banyak data yang digunakan dalam setiap estimasi lokal sehingga variasi prediktor bertambah dan CN menurun. Pada bandwidth 60, hanya 4 county yang memiliki CN > 30, dan mulai bandwidth 80 tidak ada lagi county yang melewati ambang tersebut. Pada bandwidth 159 (setara model global), CN maksimum hanya 19,21. Hal ini menegaskan bahwa kolinearitas yang terdeteksi bersifat lokal dan muncul akibat bandwidth optimal yang relatif sempit.
Hasil diagnosis menunjukkan adanya trade-off: bandwidth 47 memberikan kecocokan model terbaik (AICc minimum), tetapi menimbulkan kolinearitas lokal di 13 county. Beberapa implikasinya adalah sebagai berikut.
PctBach, PctEld, dan
intersep di 13 county dengan CN > 30 sebaiknya ditafsirkan
secara hati-hati karena berpotensi tidak stabil.PctBach yang bernilai
positif (Gambar 3) bertumpang tindih sebagian dengan klaster CN tinggi
di Georgia tengah-timur. Perubahan tanda di wilayah ini sebaiknya tidak
langsung ditafsirkan sebagai fenomena nyata tanpa pemeriksaan
tambahan.gwr.lcr) [5] dapat dipertimbangkan sebagai perbaikan.Bagian ini merangkum seluruh hasil dalam satu peta berlapis dan satu tabel yang dapat dicari, diurutkan, disaring, dan diunduh.
kartu(
c(nrow(map_sf), paste0(fmt(mean(map_sf$PctPov)), "%"), fmt(mean(map_sf$Local_CN)),
fmt(max(map_sf$Local_CN)), sum(map_sf$Local_CN > 30),
sum(map_sf$PctBach_VIF > 10) + sum(map_sf$PctRural_VIF > 10) + sum(map_sf$PctEld_VIF > 10)),
c("Jumlah county", "Rata-rata kemiskinan", "Rata-rata local CN", "Maksimum local CN",
"County local CN > 30", "County local VIF > 10")
)pal_pov <- colorNumeric("Blues", map_sf$PctPov)
pal_vifb <- colorNumeric("Blues", map_sf$PctBach_VIF)
m_coef <- function(v) { m <- max(abs(v)); colorNumeric("RdBu", c(-m, m)) }
pal_bach <- m_coef(map_sf$GWR_PctBach)
pal_rural <- m_coef(map_sf$GWR_PctRural)
pal_eld <- colorNumeric("Blues", map_sf$GWR_PctEld)
popup <- with(map_sf, sprintf(
"<div style='font-family:Plus Jakarta Sans,sans-serif;min-width:210px'>
<div style='font-weight:800;color:#0b2a4a;font-size:15px'>%s County</div>
<div style='color:#5b6b80;font-size:12px;margin-bottom:6px'>FIPS %s</div>
<table style='width:100%%;font-size:12.5px'>
<tr><td>PctPov</td><td style='text-align:right'><b>%s%%</b></td></tr>
<tr><td>Local CN</td><td style='text-align:right'><b>%s</b> (%s)</td></tr>
<tr><td>VIF Bach / Rural / Eld</td><td style='text-align:right'>%s / %s / %s</td></tr>
<tr><td>ฮฒ PctBach</td><td style='text-align:right'>%s</td></tr>
<tr><td>ฮฒ PctRural</td><td style='text-align:right'>%s</td></tr>
<tr><td>ฮฒ PctEld</td><td style='text-align:right'>%s</td></tr>
<tr><td>Local Rยฒ</td><td style='text-align:right'>%s</td></tr></table></div>",
NAME, GEOID, fmt(PctPov), fmt(Local_CN), CN_Kategori, fmt(PctBach_VIF), fmt(PctRural_VIF),
fmt(PctEld_VIF), fmt(GWR_PctBach, 4), fmt(GWR_PctRural, 4), fmt(GWR_PctEld, 4), fmt(Local_R2, 3)))
lapisan <- function(m, warna, grup) addPolygons(m, fillColor = warna, fillOpacity = .85, color = "white",
weight = .8, group = grup, popup = popup, label = map_sf$NAME,
highlightOptions = highlightOptions(weight = 2.5, color = biru[["tua"]], bringToFront = TRUE))
leaflet(map_sf, height = 620) |>
addProviderTiles(providers$CartoDB.Positron, group = "Peta terang") |>
addProviderTiles(providers$Esri.WorldImagery, group = "Citra satelit") |>
lapisan(pal_cn(map_sf$CN_Kategori), "Local Condition Number") |>
lapisan(pal_pov(map_sf$PctPov), "Kemiskinan (PctPov)") |>
lapisan(pal_vifb(map_sf$PctBach_VIF), "Local VIF PctBach") |>
lapisan(pal_bach(map_sf$GWR_PctBach), "Koefisien PctBach") |>
lapisan(pal_rural(map_sf$GWR_PctRural), "Koefisien PctRural") |>
lapisan(pal_eld(map_sf$GWR_PctEld), "Koefisien PctEld") |>
addLegend(pal = pal_cn, values = map_sf$CN_Kategori, title = "Local CN", group = "Local Condition Number", position = "bottomright") |>
addLegend(pal = pal_pov, values = map_sf$PctPov, title = "PctPov (%)", group = "Kemiskinan (PctPov)", position = "bottomright") |>
addLegend(pal = pal_vifb, values = map_sf$PctBach_VIF, title = "VIF PctBach", group = "Local VIF PctBach", position = "bottomright") |>
addLegend(pal = pal_bach, values = c(-1, 1) * max(abs(map_sf$GWR_PctBach)), title = "ฮฒ PctBach", group = "Koefisien PctBach", position = "bottomright") |>
addLegend(pal = pal_rural, values = c(-1, 1) * max(abs(map_sf$GWR_PctRural)), title = "ฮฒ PctRural", group = "Koefisien PctRural", position = "bottomright") |>
addLegend(pal = pal_eld, values = map_sf$GWR_PctEld, title = "ฮฒ PctEld", group = "Koefisien PctEld", position = "bottomright") |>
addLayersControl(
baseGroups = c("Peta terang", "Citra satelit"),
overlayGroups = c("Local Condition Number", "Kemiskinan (PctPov)", "Local VIF PctBach",
"Koefisien PctBach", "Koefisien PctRural", "Koefisien PctEld"),
options = layersControlOptions(collapsed = FALSE)) |>
hideGroup(c("Kemiskinan (PctPov)", "Local VIF PctBach", "Koefisien PctBach",
"Koefisien PctRural", "Koefisien PctEld")) |>
addMiniMap(toggleDisplay = TRUE, minimized = TRUE) |>
addScaleBar(position = "bottomleft")Gambar 15. Peta dashboard berlapis. Centang lapisan di kanan atas untuk berganti variabel; klik sebuah county untuk melihat ringkasan lengkapnya.
tabel_lengkap <- st_drop_geometry(map_sf) |>
transmute(FIPS = GEOID, County = NAME, PctPov, PctBach, PctRural, PctEld,
`Local CN` = Local_CN, `Kategori CN` = CN_Kategori,
`VIF Bach` = PctBach_VIF, `VIF Rural` = PctRural_VIF, `VIF Eld` = PctEld_VIF,
`VDP Int.` = Intercept_VDP, `VDP Bach` = PctBach_VDP, `VDP Rural` = PctRural_VDP, `VDP Eld` = PctEld_VDP,
`Koef. Intersep` = GWR_Intercept, `Koef. PctBach` = GWR_PctBach, `Koef. PctRural` = GWR_PctRural, `Koef. PctEld` = GWR_PctEld,
`Local R2` = Local_R2, Residual = GWR_Residual, LISA = LISA_Pola, `Status LISA` = LISA_Sig) |>
arrange(desc(`Local CN`))
tabel_dt(tabel_lengkap, caption = "Tabel 15. Hasil lengkap GWR dan diagnosis kolinearitas lokal untuk 159 county") |>
formatRound(c("Local CN", "VIF Bach", "VIF Rural", "VIF Eld", "Local R2", "Residual"), 3, dec.mark = ",") |>
formatRound(c("VDP Int.", "VDP Bach", "VDP Rural", "VDP Eld", "Koef. Intersep", "Koef. PctBach", "Koef. PctRural", "Koef. PctEld"), 4, dec.mark = ",") |>
formatRound(c("PctPov", "PctBach", "PctRural", "PctEld"), 2, dec.mark = ",") |>
formatStyle("Local CN", background = styleColorBar(c(0, max(tabel_lengkap$`Local CN`)), "#9cc3ea"),
backgroundSize = "95% 70%", backgroundRepeat = "no-repeat", backgroundPosition = "center") |>
formatStyle("Kategori CN", color = styleEqual(c("Rendah (<20)", "Sedang (20-30)", "Tinggi (>30)"),
c("#5b6b80", "#c77d18", "#c0392b")), fontWeight = "bold") |>
formatStyle(c("VDP Int.", "VDP Bach", "VDP Rural", "VDP Eld"),
backgroundColor = styleInterval(0.5, c("transparent", "#dbe8f7")))PctBachโPctRural) dan VIF global berada pada
rentang 1,296โ1,781.PctBach (13
county), dan PctEld (12 county), sehingga
koefisien lokal kedua prediktor tersebut berpotensi tidak stabil.[1] C. Brunsdon, A. S. Fotheringham, and M. Charlton, โGeographically weighted regression: A method for exploring spatial nonstationarity,โ Geographical Analysis, vol.ย 28, no. 4, pp.ย 281โ298, 1996.
[2] A. S. Fotheringham, C. Brunsdon, and M. Charlton, Geographically Weighted Regression: The Analysis of Spatially Varying Relationships. Chichester: John Wiley & Sons, 2002.
[3] D. C. Wheeler and M. Tiefelsdorf, โMulticollinearity and correlation among local regression coefficients in geographically weighted regression,โ Journal of Geographical Systems, vol.ย 7, pp.ย 161โ187, 2005.
[4] D. C. Wheeler, โDiagnostic tools and a remedial method for collinearity in geographically weighted regression,โ Environment and Planning A, vol.ย 39, no. 10, pp.ย 2464โ2481, 2007.
[5] I. Gollini, B. Lu, M. Charlton, C. Brunsdon, and P. Harris, โGWmodel: An R package for exploring spatial heterogeneity using geographically weighted models,โ Journal of Statistical Software, vol.ย 63, no. 17, pp.ย 1โ50, 2015.
[6] R. M. OโBrien, โA caution regarding rules of thumb for variance inflation factors,โ Quality & Quantity, vol.ย 41, pp.ย 673โ690, 2007.
[7] D. A. Belsley, E. Kuh, and R. E. Welsch, Regression Diagnostics: Identifying Influential Data and Sources of Collinearity. New York: John Wiley & Sons, 1980.
[8] P. A. P. Moran, โNotes on continuous stochastic phenomena,โ Biometrika, vol.ย 37, no. 1/2, pp.ย 17โ23, 1950.
[9] L. Anselin, โLocal indicators of spatial associationโLISA,โ Geographical Analysis, vol.ย 27, no. 2, pp.ย 93โ115, 1995.
#> R version 4.4.1 (2024-06-14 ucrt)
#> Platform: x86_64-w64-mingw32/x64
#> Running under: Windows 11 x64 (build 26200)
#>
#> Matrix products: default
#>
#>
#> locale:
#> [1] LC_COLLATE=English_Indonesia.utf8 LC_CTYPE=English_Indonesia.utf8
#> [3] LC_MONETARY=English_Indonesia.utf8 LC_NUMERIC=C
#> [5] LC_TIME=English_Indonesia.utf8
#>
#> time zone: Asia/Jakarta
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> other attached packages:
#> [1] htmltools_0.5.8.1 DT_0.33 plotly_4.10.4 leaflet_2.2.3
#> [5] ggplot2_4.0.3 dplyr_1.1.4 spdep_1.4-2 sf_1.1-0
#> [9] spData_2.3.5 car_3.1-3 carData_3.0-5 GWmodel_2.4-1
#> [13] Rcpp_1.1.1 sp_2.2-1 robustbase_0.99-7 kableExtra_1.4.0
#>
#> loaded via a namespace (and not attached):
#> [1] DBI_1.2.3 deldir_2.0-4 s2_1.1.9
#> [4] sandwich_3.1-1 rlang_1.1.7 magrittr_2.0.3
#> [7] multcomp_1.4-30 e1071_1.7-16 compiler_4.4.1
#> [10] systemfonts_1.3.1 vctrs_0.6.5 stringr_1.5.1
#> [13] pkgconfig_2.0.3 wk_0.9.5 fastmap_1.2.0
#> [16] backports_1.5.0 utf8_1.2.4 rmarkdown_2.29
#> [19] purrr_1.2.2 xfun_0.52 cachem_1.1.0
#> [22] jsonlite_2.0.0 uuid_1.2-2 parallel_4.4.1
#> [25] LearnBayes_2.15.2 R6_2.6.1 bslib_0.9.0
#> [28] stringi_1.8.4 RColorBrewer_1.1-3 boot_1.3-30
#> [31] jquerylib_0.1.4 knitr_1.51 zoo_1.8-14
#> [34] leaflet.providers_3.0.0 FNN_1.1.4.1 Matrix_1.7-0
#> [37] splines_4.4.1 igraph_2.3.0 tidyselect_1.2.1
#> [40] rstudioapi_0.17.1 abind_1.4-8 yaml_2.3.10
#> [43] codetools_0.2-20 lattice_0.22-6 tibble_3.2.1
#> [46] intervals_0.15.5 withr_3.0.3 S7_0.2.2
#> [49] coda_0.19-4.1 evaluate_1.0.5 marginaleffects_1.0.0
#> [52] survival_3.6-4 units_1.0-1 proxy_0.4-27
#> [55] xts_0.14.1 xml2_1.5.2 pillar_1.9.0
#> [58] tigris_2.2.1 KernSmooth_2.23-24 generics_0.1.3
#> [61] spacetime_1.3-4 scales_1.4.0 class_7.3-22
#> [64] glue_1.7.0 spatialreg_1.4-3 lazyeval_0.2.2
#> [67] tools_4.4.1 data.table_1.17.0 fs_1.6.6
#> [70] mvtnorm_1.3-3 grid_4.4.1 tidyr_1.3.2
#> [73] crosstalk_1.2.1 nlme_3.1-164 Formula_1.2-5
#> [76] cli_3.6.6 rappdirs_0.3.3 textshaping_1.0.4
#> [79] fansi_1.0.6 viridisLite_0.4.2 svglite_2.2.2
#> [82] gtable_0.3.6 DEoptimR_1.2-1 sass_0.4.10
#> [85] digest_0.6.37 classInt_0.4-11 TH.data_1.1-4
#> [88] htmlwidgets_1.6.4 farver_2.1.2 lifecycle_1.0.5
#> [91] httr_1.4.7 MASS_7.3-65