global_morans: Compute Global Moran's I

View source: R/moran.R

global_moransR Documentation

Compute Global Moran's I

Description

Computes the Global Moran's I statistic and expectation. Can produce spatial weights from an adjacency or sf data frame, in which case the spatial_mat is a contiguity matrix. Users can also provide a spatial_mat argument directly.

Usage

global_morans(shp, adj, wts, spatial_mat, epsg = 3857)

Arguments

shp

sf data frame. Optional if adj or spatial_mat provided.

adj

zero indexed adjacency list. Optional if shp or spatial_mat provided.

wts

Required. Numeric vector with weights to use for Moran's I.

spatial_mat

matrix of spatial weights. Optional if shp or adj provided.

epsg

numeric EPSG code to planarize to. Default is 3857.

Value

list

Examples

library(dplyr)
data('checkerboard')
checkerboard <- checkerboard %>% mutate(m = as.numeric((id + i) %% 2 == 0))
global_morans(shp = checkerboard, wts = checkerboard$m)

geomander documentation built on April 16, 2023, 5:18 p.m.