Skip to contents

Spatial correlation between x and the spatial lag of y, \(I_B = \sum_i x_i (Wy)_i / \sum_i x_i^2\), the slope of a regression of Wy on x, with both variables standardized and W row-standardized. Caveat from the source: the statistic ignores the in-place correlation between x and y at the same location and can overstate spatial association when that is strong.

Usage

bivariate_morans_i(x, y, W, scale = TRUE, row_standardize = TRUE)

Arguments

x

Focal variable, length n.

y

Lagged variable, length n.

W

Spatial weights matrix, n by n; row-standardized internally by default.

scale

Standardize x and y.

row_standardize

Divide each row of W by its sum.

Value

List with statistic, lag_y, x_std, y_std, n.

Details

Standardization follows the spdep moran_bv reference implementation: mean 0 and unit sample variance (divisor n-1).

References

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

Anselin, L. GeoDa workbook, Global Spatial Autocorrelation (2), bivariate Moran scatter plot.

Reference implementation spdep moran_bv (CRAN, source read directly).

Examples

W <- matrix(0, 4, 4); W[cbind(1:3, 2:4)] <- 1; W[cbind(2:4, 1:3)] <- 1
bivariate_morans_i(c(3, 1, 4, 1), c(2, 7, 1, 8), W)
#> $statistic
#> [1] 0.9649773
#> 
#> $lag_y
#> [1]  0.7118685 -0.8542422  0.8542422 -0.9966159
#> 
#> $x_std
#> [1]  0.5000000 -0.8333333  1.1666667 -0.8333333
#> 
#> $y_std
#> [1] -0.7118685  0.7118685 -0.9966159  0.9966159
#> 
#> $n
#> [1] 4
#> 
#> $method
#> [1] "Bivariate Moran I (Anselin-Syabri-Smirnov 2002)"
#>