Package 'ArchipelagoEngine'

Title: Spatial Weight Construction for Archipelagic Geographies
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>.
Authors: NJ Talingting [aut, cre] (ORCID: <https://orcid.org/0009-0003-7245-874X>)
Maintainer: NJ Talingting <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2026-06-08 14:53:45 UTC
Source: https://github.com/pinasr/ArchipelagoEngine

Help Index


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 sf object containing the geographic boundaries.

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.