mem_multithreshold: Moran's Eigenvector Maps for different distance thresholds

View source: R/mem_multithreshold.R

mem_multithresholdR Documentation

Moran's Eigenvector Maps for different distance thresholds

Description

Computes Moran's Eigenvector Maps of a distance matrix (using mem()) over different distance thresholds.

Usage

mem_multithreshold(
  distance.matrix = NULL,
  distance.thresholds = NULL,
  max.spatial.predictors = NULL
)

Arguments

distance.matrix

Distance matrix. Default: NULL.

distance.thresholds

Numeric vector with distance thresholds defining neighborhood in the distance matrix, Default: NULL.

max.spatial.predictors

Maximum number of spatial predictors to generate. Only useful to save memory when the distance matrix x is very large. Default: NULL.

Details

The function takes the distance matrix x, computes its weights at difference distance thresholds, double-centers the resulting weight matrices with double_center_distance_matrix(), applies eigen to each double-centered matrix, and returns eigenvectors with positive normalized eigenvalues for different distance thresholds.

Value

A data frame with as many rows as the distance matrix x containing positive Moran's Eigenvector Maps. The data frame columns are named "spatial_predictor_DISTANCE_COLUMN", where DISTANCE is the given distance threshold, and COLUMN is the column index of the given spatial predictor.

Examples

if(interactive()){

 #loading example data
 data(distance_matrix)

 #computing Moran's eigenvector maps for 0, 1000, and 2000 km
 mem.df <- mem_multithreshold(
   distance.matrix = distance_matrix,
   distance.thresholds = c(0, 1000, 2000)
   )
 head(mem.df)

}

spatialRF documentation built on Aug. 19, 2022, 5:23 p.m.