local_c: Compute Local Geary statistic

View source: R/localC.R

local_cR Documentation

Compute Local Geary statistic

Description

The Local Geary is a local adaptation of Geary's C statistic of spatial autocorrelation. The Local Geary uses squared differences to measure dissimilarity unlike the Local Moran. Low values of the Local Geary indicate positive spatial autocorrelation and large refers to negative spatial autocorrelation. Inference for the Local Geary is based on a permutation approach which compares the observed value to the reference distribution under spatial randomness. The Local Geary creates a pseudo p-value. This is not an analytical p-value and is based on the number of permutations and as such should be used with care.

Usage

local_c(x, nb, wt, ...)

local_c_perm(x, nb, wt, nsim = 499, alternative = "two.sided", ...)

Arguments

x

a numeric vector, or list of numeric vectors of equal length.

nb

a neighbor list

wt

a weights list

...

other arguments passed to spdep::localC_perm(), e.g. zero.policy = TRUE to allow for zones without neighbors.

nsim

The number of simulations used to generate reference distribution.

alternative

A character defining the alternative hypothesis. Must be one of "two.sided", "less" or "greater".

Details

Overview

The Local Geary can be extended to a multivariate context. When x is a numeric vector, the univariate Local Geary will be calculated. To calculate the multivariate Local Moran provide either a list or a matrix. When x is a list, each element must be a numeric vector of the same length and of the same length as the neighbours in listw. In the case that x is a matrix the number of rows must be the same as the length of the neighbours in listw.

While not required in the univariate context, the standardized Local Geary is calculated. The multivariate Local Geary is always standardized.

The univariate Local Geary is calculated as c_i = \sum_j w_{ij}(x_i - x_j)^2 and the multivariate Local Geary is calculated as c_{k,i} = \sum_{v=1}^{k} c_{v,i} as described in Anselin (2019).

Implementation

These functions are based on the implementations of the local Geary statistic in the development version of spdep. They are based on spdep::localC and spdep::localC_perm.

spdep::localC_perm and thus local_c_perm utilize a conditional permutation approach to approximate a reference distribution where each observation i is held fixed, randomly samples neighbors, and calculated the local C statistic for that tuple (ci). This is repeated nsim times. From the simulations 3 different types of p-values are calculated—all of which have their potential flaws. So be extra judicious with using p-values to make conclusions.

  • p_ci: utilizes the sample mean and standard deviation. The p-value is then calculated using pnorm()–assuming a normal distribution which isn't always true.

  • p_ci_sim: uses the rank of the observed statistic.

  • p_folded_sim: follows the pysal implementation where p-values are in the range of [0, 0.5]. This excludes 1/2 of all p-values and should be used with caution.

Value

a data.frame with columns

  • ci: Local Geary statistic

  • e_ci: expected value of the Local Geary based on permutations

  • z_ci: standard deviation based on permutations

  • var_ci: variance based on permutations

  • p_ci: p-value based on permutation sample standard deviation and means

  • p_ci_sim: p-value based on rank of observed statistic

  • p_folded_sim: p-value based on the implementation of Pysal which always assumes a two-sided test taking the minimum possible p-value

  • skewness: sample skewness

  • kurtosis: sample kurtosis

Author(s)

Josiah Parry, josiah.parry@gmail.com

References

Anselin, L. (1995), Local Indicators of Spatial Association—LISA. Geographical Analysis, 27: 93-115. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/j.1538-4632.1995.tb00338.x")}

Anselin, L. (2019), A Local Indicator of Multivariate Spatial Association: Extending Geary's c. Geogr Anal, 51: 133-150. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1111/gean.12164")}

Examples


local_c_perm(guerry_nb$crime_pers, guerry_nb$nb, guerry_nb$wt)


sfdep documentation built on Sept. 13, 2024, 5:07 p.m.