View source: R/spatial_weights.R
spatial_autocor | R Documentation |
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.
spatial_autocor(X, cds, radius = 8, nsamples = 1000)
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. |
A sparse matrix representing the spatial autocorrelation matrix for the input data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.