Skip to content

SpatialInference

0.1.0Package record

Tools for Statistical Inference with Geo-Coded Data

0packages depend
1.5Kdownloads / year
48.5%test coverage
13/13flavors OK

Overview

About

Fast computation of Conley (1999) doi:10.1016/S0304-4076(98)00084-0 spatial heteroskedasticity and autocorrelation consistent (HAC) standard errors for linear regression models with geo-coded data, with a fast C++ implementation by Christensen, Hartman, and Samii (2021) doi:10.1017/S0020818321000187. Performance-critical distance calculations, kernel weighting, and variance component accumulation are implemented in C++ via 'Rcpp' and 'RcppArmadillo'. Includes tools for estimating the spatial correlation range from covariograms and correlograms following the bandwidth selection method proposed in Lehner (2026) doi:10.48550/arXiv.2603.03997, and diagnostic visualizations for bandwidth selection.

Changes in 0.1.0
  • Initial CRAN release.

Conley spatial HAC standard errors

  • conley_SE() computes Conley (1999) spatial HAC variance-covariance matrices for lfe::felm() models, with support for cross-sectional spatial correlation, serial (temporal) correlation, and the combined spatial HAC estimator.
  • Six kernel functions: Bartlett, Epanechnikov, Gaussian, Parzen, Biweight, and Uniform.
  • Haversine great-circle distances (default) and a 111 km/degree approximation.
  • Balanced-panel optimisation pre-computes the distance matrix once.
  • compute_conley_lfe() convenience wrapper for quick single-coefficient extraction.
  • lm_sac() all-in-one workflow: regression, Moran's I tests, and Conley standard errors, with modelsummary integration via custom tidy and glance methods.
Show all changes in 0.1.0Hide the rest of the changes in 0.1.0

Bandwidth selection

  • covgm_range() estimates the spatial correlation range from the empirical covariogram of regression residuals (Lehner 2026).
  • extract_corr_range() extracts the zero-crossing distance from a covariogram (gstat::variogram()) or correlogram (ncf::correlog()).
  • inverseu_plot_conleyrange() diagnostic plot showing how the Conley SE varies with the bandwidth, revealing the inverse-U relationship (Lehner 2026).

Spatial utilities

  • DistMat() kernel-weighted spatial distance matrix (C++).
  • coords_as_columns() extracts sf point coordinates into tibble columns.
  • gravity_centroid() computes the (optionally weighted) geographic centroid of an sf object.
  • grid_FE() assigns observations to spatial grid cells for use as fixed effects.

Performance

  • Distance matrix computation, kernel weighting, and variance component accumulation (XeeXhC, Bal_XeeXhC, XeeXhC_Lg, TimeDist) are implemented in C++ via Rcpp and RcppArmadillo.
  • Memory-efficient large-sample variant (XeeXhC_Lg) avoids constructing the full n x n distance matrix when n > 50,000.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 3.5 min · r-devel-windows-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK13 OK2026-04-22
  • ERROR12 OK, 1 ERROR2026-04-18
  • OK5 OK2026-03-26
Advisories

none known

Documentation

In release 0.1.0
READMEYes · 315 wordsVignettesYes · 1 · dynamicNEWSYes · 67% structured · mentions 0.1.0Citation fileNoWebsitenot declared in DESCRIPTION
Help pages
21 (6 internal)includes a package overview page
Examples that run
11%1 run in a plain check · 8 only when donttest examples are enabled (R CMD check --as-cran)
Exported functions with examples
60%
Documented parameters
100%
Return-value docs
93%
Help pages citing references
48%
Vignettes (1)

Downloads

1.5K
CRAN downloads in the past year
Rank #22,026 · ~4/day · ~125/mo
Daily download trend is not available in this view yet.
19830 days
60190 days
1.5K1 year
Compare downloads with other packages →
Also on171 r2u2 autocran

Repository

2Stars
0Forks
0Open issues
0Open PRs
0Releases
57Commits
2Commit identities
License file reads as GPL-3.0 · 57 commits · Last activity 2026-03-21 · +100% stars, 30d
Responsiveness
How these are sampled
PRs merged (all time)
100%
Median days to close, 50 most recently updated closed issues
not measured
Median days to close, 50 most recently updated closed PRs
0

Stars over time

2026-07-07 · 02026-10-22 · 2
PracticesBeta

3 development-tooling and community-health practices detected across 3 families in the upstream repository

Checks run against github.com/axlehner/spatialinference on 2026-10-18.

Continuous integration (1)
GitHub Actions
CRAN release process (1)
cran-comments.md
Lint, format, editor (1)
RStudio project
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
21 external dependencies (excludes base and recommended)

Installing SpatialInference adds 21 packages (17 with compiled code, 27 MB of source tarballs). Heaviest: sf 9.3 MB, data.table 5.7 MB, s2 2.8 MB.

Depends (1)
R >= 4.1.0
LinkingTo (2)
Enhances (0)
none
Reverse dependencies
0direct
0indirect

Nothing depends on this yet.

Datasets

People & History

People (1)
Author, Maintainer since 0.1.0 (2026)
Releases (1)
  • R
    R 4.6.0 released · 2026-04-24
  • 0.1.0Latest
    2026-03-25 · current release
  • R
    R 4.5.0 released · 2025-04-11

Package metadata

First published
2026-03-25
Total releases
1 / 1 yrs
License
GPL (>= 3) OSI
Minimum R
≥ 4.1.0
Bundled data
439 KB / 1 file
Download size
1.1 MB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("SpatialInference")
Lehner, A. (2026). SpatialInference: Tools for Statistical Inference with Geo-Coded Data (Version 0.1.0) [Computer software]. https://doi.org/10.32614/CRAN.package.SpatialInference

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for SpatialInference version 0.1.0 [Data set]. HJJB, LLC. Data release v2026-10-22. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy