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.
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.
- maxk
Maximum number of neighbors to request from the NN search before radius filtering (prevents O(n^2) memory). Default 64.