Learn R Programming

emdi (version 2.2.1)

spatialcor.tests: Spatial Autocorrelation Tests

Description

This function computes two spatial autocorrelation tests: Moran's I and Geary's C.

Usage

spatialcor.tests(direct, corMatrix)

Value

The values of the test statistics and their corresponding p values.

Arguments

direct

a vector containing direct estimates. The elements of direct must be sorted like the elements in corMatrix.

corMatrix

matrix or data frame with dimensions number of areas times number of areas containing the row-standardized proximities between the domains. Values must lie between 0 and 1. The columns and rows must be sorted like the domains in direct.

Details

When creating the proximity matrix corMatrix, please make sure that the elements of direct and corMatrix are sorted equally and that direct and corMatrix do not contain any NAs. For a description of how to create the proximity matrix, see the package vignette "A Framework for Producing Small Area Estimates Based on Area-Level Models in R". If direct estimates do not exist for every area contained in the proximity matrix, the proximity matrix needs to be subsetted to the areas contained in the direct vector.

References

Bivand, R. (2019), spdep: Spatial Dependence: Weighting Schemes, Statistics. R package.

Examples

Run this code
# Loading data - sample data and proximity matrix
data("eusilcA_smpAgg")
data("eusilcA_prox")

# Compute spatial correlation tests
spatialcor.tests(
  direct = eusilcA_smpAgg$Mean,
  corMatrix = eusilcA_prox
)

Run the code above in your browser using DataLab