Learn R Programming

spdep (version 1.4-2)

Spatial Dependence: Weighting Schemes, Statistics

Description

A collection of functions to create spatial weights matrix objects from polygon 'contiguities', from point patterns by distance and tessellations, for summarizing these objects, and for permitting their use in spatial data analysis, including regional aggregation by minimum spanning tree; a collection of tests for spatial 'autocorrelation', including global 'Morans I' and 'Gearys C' proposed by 'Cliff' and 'Ord' (1973, ISBN: 0850860369) and (1981, ISBN: 0850860814), 'Hubert/Mantel' general cross product statistic, Empirical Bayes estimates and 'Assunção/Reis' (1999) Index, 'Getis/Ord' G ('Getis' and 'Ord' 1992) and multicoloured join count statistics, 'APLE' ('Li et al.' ) , local 'Moran's I', 'Gearys C' ('Anselin' 1995) and 'Getis/Ord' G ('Ord' and 'Getis' 1995) , 'saddlepoint' approximations ('Tiefelsdorf' 2002) and exact tests for global and local 'Moran's I' ('Bivand et al.' 2009) and 'LOSH' local indicators of spatial heteroscedasticity ('Ord' and 'Getis') . The implementation of most of these measures is described in 'Bivand' and 'Wong' (2018) , with further extensions in 'Bivand' (2022) . 'Lagrange' multiplier tests for spatial dependence in linear models are provided ('Anselin et al'. 1996) , as are 'Rao' score tests for hypothesised spatial 'Durbin' models based on linear models ('Koley' and 'Bera' 2023) . Additions in 2024 include Local Indicators for Categorical Data based on 'Carrer et al.' (2021) and 'Bivand et al.' (2017) ; also Weighted Multivariate Spatial Autocorrelation Measures ('Bavaud' 2024) . . A local indicators for categorical data (LICD) implementation based on 'Carrer et al.' (2021) and 'Bivand et al.' (2017) was added in 1.3-7. Multivariate 'spatialdelta' ('Bavaud' 2024) was added in 1.3-13 ('Bivand' 2025 ). From 'spdep' and 'spatialreg' versions >= 1.2-1, the model fitting functions previously present in this package are defunct in 'spdep' and may be found in 'spatialreg'.

Copy Link

Version

Install

install.packages('spdep')

Monthly Downloads

41,127

Version

1.4-2

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Roger Bivand

Last Published

February 13th, 2026

Functions in spdep (1.4-2)

edit.nb

Interactive editing of neighbours lists
hotspot

Cluster Classifications for Local Indicators of Spatial Association and Local Indicators for Categorical Data
geary.test

Geary's C test for spatial autocorrelation
knn2nb

Neighbours list from knn object
globalG.test

Global G test for spatial autocorrelation
cell2nb

Generate neighbours list for grid cells
lag.listw

Spatial lag of a numeric vector
geary.mc

Permutation test for Geary's C statistic
lee.test

Lee's L test for spatial autocorrelation
geary

Compute Geary's C
licd_multi

Local Indicators for Categorical Data
eire

Eire data sets
localC

Compute Local Geary statistic
include.self

Include self in neighbours list
lm.morantest

Moran's I test for residual spatial autocorrelation
lm.morantest.sad

Saddlepoint approximation of global Moran's I test
lee.mc

Permutation test for Lee's L statistic
lee

Compute Lee's statistic
local_joincount_bv

Calculate the local bivariate join count
local_joincount_uni

Calculate the local univariate join count
lm.morantest.exact

Exact global Moran's I test
moran.mc

Permutation test for Moran's I statistic
moran.plot

Moran scatterplot
moran_bv

Compute the Global Bivariate Moran's I
moran.test

Moran's I test for spatial autocorrelation
mat2listw

Convert a square spatial weights matrix to a weights list object
moran

Compute Moran's I
nb2lines

Use vector files for import and export of weights
nb2listw

Spatial weights for neighbours lists
nb2mat

Spatial weights matrices for neighbours lists
nb2listwdist

Distance-based spatial weights for neighbours lists
nbdists

Spatial link distance measures
knearneigh

K nearest neighbours for spatial weights
grid2nb

Construct neighbours for a GridTopology
localG

G and Gstar local spatial statistics
graphneigh

Graph based spatial weights
joincount.test

BB join count statistic for k-coloured factors
localGS

A local hotspot statistic for analysing multiscale datasets
nbcosts

Compute cost of edges
nb2WB

Output spatial weights for WinBUGS
nb2INLA

Output spatial neighbours for INLA
localmoran.exact

Exact local Moran's Ii tests
localmoran

Local Moran's I statistic
prunecost

Compute cost of prune each edge
plot.nb

Plot a neighbours list
nb2blocknb

Block up neighbour list for location-less observations
nblag

Higher order neighbours lists
mstree

Find the minimal spanning tree
plot.skater

Plot the object of skater class
read.gal

Read a GAL lattice file into a neighbours list
nb.set.operations

Set operations on neighborhood objects
prunemst

Prune a Minimun Spanning Tree
tri2nb

Neighbours list from tri object
write.nb.gal

Write a neighbours list as a GAL lattice file
joincount.mc

Permutation test for same colour join count statistics
localmoran_bv

Compute the Local Bivariate Moran's I Statistic
poly2nb

Construct neighbours list from polygon list
lm.LMtests

Rao's score (a.k.a Lagrange Multiplier) diagnostics for spatial dependence in linear models
probmap

Probability mapping for rates
listw2sn

Spatial neighbour sparse representation
localmoran.sad

Saddlepoint approximation of local Moran's Ii tests
joincount.multi

BB, BW and Jtot join count statistic for k-coloured factors
plot.mst

Plot the Minimum Spanning Tree
is.symmetric.nb

Test a neighbours list for symmetry
p.adjustSP

Adjust local association measures' p-values
spatialdelta

Weighted Multivariate Spatial Autocorrelation Measures
sp.correlogram

Spatial correlogram
tolerance.nb

Function to construct edges based on a tolerance angle and a maximum distance
sp.mantel.mc

Mantel-Hubert spatial general cross product statistic
spdep-defunct

Defunct Functions in Package spdep
set.spChkOption

Control checking of spatial object IDs
skater

Spatial 'K'luster Analysis by Tree Edge Removal
ssw

Compute the sum of dissimilarity
Rotation

Rotate a set of point by a certain angle
subset.listw

Subset a spatial weights list
spweights.constants

Provides constants for spatial weights matrices
spdep

Return package version number
set.mcOption

Options for parallel support
read.gwt2nb

Read and write spatial neighbour files
subset.nb

Subset a neighbours list
summary.nb

Print and summary function for neighbours and weights lists
EBImoran.mc

Permutation test for empirical Bayes index
oldcol

Columbus OH spatial analysis data set - old numbering
EBest

Global Empirical Bayes estimator
autocov_dist

Distance-weighted autocovariate
card

Cardinalities for neighbours lists
LOSH

Local spatial heteroscedasticity
Graph Components

Depth First Search on Neighbor Lists
LOSH.mc

Bootstrapping-based test for local spatial heteroscedasticity
LOSH.cs

Chi-square based test for local spatial heteroscedasticity
EBlocal

Local Empirical Bayes estimator
droplinks

Drop and add links in a neighbours list
bhicv

Data set with 4 life condition indices of Belo Horizonte region
SD.RStests

Rao's score and adjusted Rao's score tests of linear hypotheses for spatial Durbin and spatial Durbin error models
aggregate.nb

Aggregate a spatial neighbours object
airdist

Measure distance from plot
dnearneigh

Neighbourhood contiguity by distance
diffnb

Differences between neighbours lists
choynowski

Choynowski probability map values
columbus

Columbus OH spatial analysis data set