Formula: I_i = z_i sum_j w_ij z_j / m2, z_i = x_i - xbar, m2 = sum_i z_i^2 / n
References
Anselin (1995), Local Indicators of Spatial Association – LISA, Geographical Analysis 27(2):93-115, formula (12) p.99. The article is paywalled; the formula and the divide-by-n variance convention were taken from spdep::localmoran, the reference implementation, which cites that equation explicitly.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Localmoran(V, V)
#> $local
#> [1] 2.3333333 3.3333333 3.0000000 1.3333333 -1.6666667 -6.0000000
#> [7] -11.6666667 -18.6666667 1.6666667 2.3809524 2.1428571 0.9523810
#> [13] -1.1904762 -4.2857143 -8.3333333 -13.3333333 1.0000000 1.4285714
#> [19] 1.2857143 0.5714286 -0.7142857 -2.5714286 -5.0000000 -8.0000000
#> [25] 0.3333333 0.4761905 0.4285714 0.1904762 -0.2380952 -0.8571429
#> [31] -1.6666667 -2.6666667 -0.3333333 -0.4761905 -0.4285714 -0.1904762
#> [37] 0.2380952 0.8571429 1.6666667 2.6666667 -1.0000000 -1.4285714
#> [43] -1.2857143 -0.5714286 0.7142857 2.5714286 5.0000000 8.0000000
#> [49] -1.6666667 -2.3809524 -2.1428571 -0.9523810 1.1904762 4.2857143
#> [55] 8.3333333 13.3333333 -2.3333333 -3.3333333 -3.0000000 -1.3333333
#> [61] 1.6666667 6.0000000 11.6666667 18.6666667
#>
#> $global_i
#> [1] 0
#>
#> $m2
#> [1] 5.25
#>
#> $z
#> [1] -3.5 -2.5 -1.5 -0.5 0.5 1.5 2.5 3.5
#>
#> $lag
#> [1] -3.5 -7.0 -10.5 -14.0 -17.5 -21.0 -24.5 -28.0 -2.5 -5.0 -7.5 -10.0
#> [13] -12.5 -15.0 -17.5 -20.0 -1.5 -3.0 -4.5 -6.0 -7.5 -9.0 -10.5 -12.0
#> [25] -0.5 -1.0 -1.5 -2.0 -2.5 -3.0 -3.5 -4.0 0.5 1.0 1.5 2.0
#> [37] 2.5 3.0 3.5 4.0 1.5 3.0 4.5 6.0 7.5 9.0 10.5 12.0
#> [49] 2.5 5.0 7.5 10.0 12.5 15.0 17.5 20.0 3.5 7.0 10.5 14.0
#> [61] 17.5 21.0 24.5 28.0
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Local Moran's I (LISA)"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
