Calculate local Getis-Ord Gi or Gi* statistics.

LocalGi(
  X,
  W,
  gstar = TRUE,
  alternative = c("two.sided", "less", "greater"),
  p.adjust.method = "BH"
)

Arguments

X

A matrix with observations as rows and features as columns.

W

A weight matrix across all observations, i.e inverse of a pairwise distance matrix.

gstar

Whether to calculate the Gi* statistics, default is TRUE.

alternative

Alternative hypothesis used, default is two.sided.

p.adjust.method

Method used for multiple comparisons correction, default is BH. See p.adjust.

Value

A list containing the following:

  • Gi, Gi or Gi* statistics.

  • p.val, permutation based p-value.

  • p.adj, adjusted p-values.

  • gstar, permutation used if returned.

  • alternative, alternative hypothesis used.

  • p.adjust.method, method used for multiple comparisons correction.

References

Getis, A. & Ord, J. K. The analysis of spatial association by use of distance statistics. Geogr. Anal. 24, 189–206 (1992)

Examples

{
data.use <- quakes[1:100,]
W <- 1/as.matrix(dist(data.use[,1:2]))
diag(W) <- 0
res <- LocalGi(data.use[,3:4], W)
}