Skip to contents

\(I^B_i = x_i \sum_j w_{ij} y_j\) with x and y standardised when scale, as spdep::localmoran_bv. For unit i the neighbour values of y are redrawn nsim times with replacement from the other n - 1 values; draws come from Philox stream i of seed (index floor(u (n - 1))), identical to the Python arm (spdep uses R's generator). Reported per unit: permutation mean and variance, deviate, two-sided normal p-value and folded pseudo p-value (min(#sim >= I, nsim - #sim >= I) + 1) / (nsim + 1). Quadrants compare x with its mean and the unscaled lag of y with the lag's mean (ties are Low).

Usage

LocalMoranBivariate(x, y, W, nsim = 199L, seed = 1L, scale = TRUE)

Arguments

x

Values at the focal unit.

y

Values whose spatial lag is taken.

W

Spatial weights; every unit needs a neighbour.

nsim

Permutations per unit.

seed

Philox seed.

scale

Standardise x and y first.

Value

List with local_values, statistic (mean), expected, variance, z, p_normal, p_folded, quadrant, nsim.

References

Anselin, L., Syabri, I. and Smirnov, O. (2002). Visualizing multivariate spatial correlation with dynamically linked windows. New Tools for Spatial Data Analysis: Proceedings of the Specialist Meeting. CSISS, Santa Barbara.

Examples

W <- matrix(0, 4, 4); W[cbind(1:3, 2:4)] <- 1; W <- W + t(W)
LocalMoranBivariate(c(1, 2, 4, 8), c(2, 1, 5, 7), W, nsim = 9)$local_values
#> [1] 0.88710907 0.10264072 0.01466296 0.62317579