| Title: | Spatial Weight Construction for Archipelagic Geographies |
| Version: | 0.1.1 |
| Description: | Implements specialized K-Nearest Neighbor (KNN) logic to address the unique challenges of spatial modeling in archipelagic environments. Standard contiguity models often leave significant portions of island nations (e.g., 20% of the Philippines) mathematically isolated. This package provides tools to ensure 100% network connectivity, neutralizing spatial bias and enabling robust econometric inference. Methodology follows Anselin (1988, ISBN:9024737354) and LeSage and Pace (2009) <doi:10.1201/9781420064254>. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.3 |
| Imports: | sf, spdep, magrittr |
| Suggests: | splm, spatialreg, knitr, rmarkdown, testthat (≥ 3.0.0) |
| Config/testthat/edition: | 3 |
| Depends: | R (≥ 3.5) |
| NeedsCompilation: | no |
| Packaged: | 2026-03-06 03:54:00 UTC; Nino Jay Talingting |
| Author: | NJ Talingting [aut, cre] |
| Maintainer: | NJ Talingting <ninotalingting77@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-03-10 12:10:07 UTC |
Build Archipelagic Spatial Weights
Description
Bridges fragmented island networks using K-Nearest Neighbors (KNN) to ensure 100% connectivity (nc=1). This prevents the "orphaning" of island units common in standard Queen-contiguity models.
Usage
build_archipelago_weight(p_map, k = 5)
Arguments
p_map |
An |
k |
Integer. Number of neighbors. Default is 5, optimized for Philippine archipelagic connectivity. |
Details
Standard Queen-contiguity models inherently fail in archipelagic settings. In the Philippine context, Queen logic leaves 16 provinces (approx. 20%) mathematically isolated, resulting in a fragmented network with only 80.2% connectivity.
This fragmentation introduces systematic predictive bias, evidenced by significant Residual Spatial Autocorrelation (Moran's I = 0.024, p < 0.05) and a higher AIC (201.896).
By enforcing a unified grid (k=5), this function achieves:
100% Network Connectivity (nc=1)
Neutralized Spatial Bias (Moran's I approx. 0, p > 0.10)
Robust Spatial Spillovers (Lambda stable at ~0.26)
While the Queen model may appear to have a "tighter" fit (Log-Likelihood: -96.948), the KNN (k=5) specification (Log-Likelihood: -97.472) is prioritized for structural robustness and randomized residuals.
Value
A listw object compatible with spatial regression models.
Examples
# Example: Ensuring 100% connectivity for 81 provinces
weights <- build_archipelago_weight(raw_data, k = 5)
spdep::n.comp.nb(weights$neighbours)$nc
Philippine Provincial Map (81 Provinces)
Description
A processed sf object of the Philippines used to validate archipelagic
spatial weights. This dataset serves as the benchmark for bridging
fragmented maritime networks.
Usage
raw_data
Format
An sf object with 81 rows and geographic boundaries:
-
Standard Queen Connectivity: 80.2% (16 isolated units)
-
ArchipelagoEngine (k=5) Connectivity: 100.0% (0 isolated units)
Source
https://gadm.org/ and research by Nino Jay Talingting.