Skip to contents

Given two continuous numeric variables, calculate the bivariate Local Moran's I.

Usage

local_moran_bv(x, y, nb, wt, nsim = 499)

Arguments

x

a numeric vector of same length as y.

y

a numeric vector of same length as x.

nb

a neighbor list object for example as created by st_contiguity().

wt

a weights list as created by st_weights().

nsim

the number of simulations to run.

Value

a data.frame containing two columns Ib and p_sim containing the local bivariate Moran's I and simulated p-values respectively.

Details

The Bivariate Local Moran, like its global counterpart, evaluates the value of x at observation i with its spatial neighbors' value of y. The value of $$I_i^B$$ is just xi * Wyi. Or, in simpler words the local bivariate Moran is the result of multiplying x by the spatial lag of y. Formally it is defined as

\( I_i^B= cx_i\Sigma_j{w_{ij}y_j} \)

See also

Examples

x <- guerry_nb$crime_pers
y <- guerry_nb$wealth
nb <- guerry_nb$nb
wt <- guerry_nb$wt
local_moran_bv(x, y, nb, wt)
#>              Ib p_sim
#> 1   0.093506129 0.416
#> 2  -0.840144689 0.002
#> 3   0.293390275 0.228
#> 4  -0.782969282 0.034
#> 5  -0.343051282 0.026
#> 6  -0.751763780 0.058
#> 7  -1.212286959 0.168
#> 8   0.494768137 0.346
#> 9   0.050875987 0.012
#> 10 -0.033508122 0.404
#> 11  0.119135965 0.398
#> 12 -0.027058053 0.482
#> 13  0.189608296 0.120
#> 14 -0.184931534 0.034
#> 15  0.186274796 0.260
#> 16 -0.042411941 0.302
#> 17  0.006353979 0.488
#> 18 -0.408271216 0.050
#> 19 -0.115344980 0.440
#> 20  0.130059701 0.444
#> 21  1.683274652 0.036
#> 22 -0.003842500 0.486
#> 23 -1.004957821 0.122
#> 24 -1.104136137 0.000
#> 25  0.857180921 0.002
#> 26 -0.169492824 0.004
#> 27  0.834090623 0.186
#> 28 -0.171464343 0.318
#> 29 -0.034233828 0.348
#> 30 -0.051026184 0.232
#> 31 -0.046850788 0.440
#> 32  0.334455413 0.270
#> 33  0.080264717 0.242
#> 34  0.685071940 0.178
#> 35  0.001704856 0.498
#> 36 -0.079714992 0.102
#> 37  0.137434262 0.356
#> 38  0.125025064 0.192
#> 39 -0.068341930 0.192
#> 40  0.504579881 0.096
#> 41 -0.319036396 0.070
#> 42 -0.016497540 0.352
#> 43  0.225196989 0.026
#> 44 -0.224572220 0.368
#> 45 -0.003990683 0.442
#> 46 -1.017640129 0.084
#> 47  0.367618246 0.200
#> 48 -0.550574797 0.248
#> 49  0.441828404 0.032
#> 50 -0.088146734 0.398
#> 51 -0.190742450 0.336
#> 52  0.537482661 0.112
#> 53 -0.039104825 0.414
#> 54  0.305236945 0.072
#> 55 -0.337570608 0.330
#> 56 -0.155974076 0.264
#> 57 -0.526846963 0.182
#> 58 -1.393680416 0.000
#> 59 -0.832978265 0.024
#> 60 -0.326847547 0.152
#> 61 -0.269459435 0.038
#> 62 -0.443421284 0.028
#> 63 -0.158620813 0.392
#> 64 -0.066683215 0.480
#> 65 -0.790102037 0.074
#> 66 -1.406140486 0.156
#> 67 -0.058461082 0.228
#> 68 -0.004884983 0.488
#> 69 -0.125083947 0.342
#> 70 -1.236566942 0.044
#> 71  1.282709560 0.004
#> 72  0.218277696 0.040
#> 73 -0.366089264 0.000
#> 74  1.371117985 0.002
#> 75 -0.075151611 0.206
#> 76 -1.560168225 0.024
#> 77  0.658190968 0.078
#> 78  0.246687028 0.236
#> 79 -0.139720645 0.412
#> 80 -0.206370145 0.294
#> 81 -0.003905568 0.460
#> 82 -0.205045471 0.178
#> 83 -0.534172545 0.004
#> 84 -0.046631364 0.216
#> 85  0.279224938 0.008