spatial_autocor: Compute a spatial autocorrelation matrix

View source: R/spatial_weights.R

spatial_autocorR Documentation

Compute a spatial autocorrelation matrix

Description

This function computes a spatial autocorrelation matrix using a radius-based nearest neighbor search. The function leverages the mgcv package to fit a generalized additive model (GAM) to the data and constructs the autocorrelation matrix using the fitted model.

Usage

spatial_autocor(X, cds, radius = 8, nsamples = 1000)

Arguments

X

A numeric matrix or data.frame, where each column represents a variable and each row represents an observation.

cds

A numeric matrix or data.frame of spatial coordinates (x, y, or more dimensions) with the same number of rows as X.

radius

A positive numeric value representing the search radius for the radius-based nearest neighbor search. Default is 8.

nsamples

A positive integer indicating the number of samples to be taken for fitting the GAM. Default is 1000.

Value

A sparse matrix representing the spatial autocorrelation matrix for the input data.


bbuchsbaum/graphweights documentation built on April 4, 2024, 7:19 p.m.