Learn R Programming

sdsfun (version 0.7.0)

moran_test: test global spatial autocorrelation

Description

Spatial autocorrelation test based on global moran index.

Usage

moran_test(sfj, wt = NULL, alternative = "greater", symmetrize = FALSE)

Value

A list with moran_test class and result stored on the result tibble. Which contains the following information for each variable:

MoranI

observed value of the Moran coefficient

EI

expected value of Moran's I

VarI

variance of Moran's I (under normality)

ZI

standardized Moran coefficient

PI

p-value of the test statistic

Arguments

sfj

An sf object or can be converted to sf by sf::st_as_sf().

wt

(optional) Spatial weight matrix. Must be a matrix class. If wt is not provided, sdsfun will use a first-order queen adjacency binary matrix.

alternative

(optional) Specification of alternative hypothesis as greater (default), lower, or two.sided.

symmetrize

(optional) Whether or not to symmetrize the asymmetrical spatial weight matrix wt by: 1/2 * (wt + wt'). Default is FALSE.

Examples

Run this code
gzma = sf::read_sf(system.file('extdata/gzma.gpkg',package = 'sdsfun'))
moran_test(gzma)

Run the code above in your browser using DataLab