Calculate permutation based p-value for local Moran's I.

PermutationLocalI(
  x,
  W,
  n = 999,
  seed = 1,
  alternative = c("two.sided", "less", "greater"),
  p.adjust.method = "BH",
  normalize = TRUE,
  scale = TRUE,
  return.permutation = FALSE,
  condition = 0
)

Arguments

x

A numerical vector.

W

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

n

The number of permutations to be conducted, set to 999 by default.

seed

Random seed used. Default is 1.

alternative

Alternative hypothesis used, default is two.sided.

p.adjust.method

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

normalize

Whether to normalize the weight matrix such that each row adds up to one. Default is TRUE.

scale

Whether to scale the data. Default is TRUE.

return.permutation

Return permutations. Default is FALSE.

condition

Value under null hypothesis to compare with, default is 0.

Value

A list containing the following:

  • Local.Morans.I, local Moran's I.

  • p.val, permutation based p-value.

  • p.adj, adjusted p-values.

  • scale.factor, number of observations.

  • return.permutation, permutation used if returned.

  • params, parameters used to calculate local Moran's I.

Examples

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