Skip to contents

Moran's I is calculated for each polygon based on the neighbor and weight lists.

Usage

local_moran(x, nb, wt, alternative = "two.sided", nsim = 499, ...)

Arguments

x

A numeric vector.

nb

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

wt

a weights list as created by st_weights().

alternative

default "two.sided". Should be one of "greater", "less", or "two.sided" to specify the alternative hypothesis.

nsim

The number of simulations to run.

...

See ?spdep::localmoran_perm() for more options.

Value

a data.frame containing the columns ii, eii, var_ii, z_ii, p_ii, p_ii_sim, and p_folded_sim. For more details please see spdep::localmoran_perm().

Details

local_moran() calls spdep::localmoran_perm() and calculates the Moran I for each polygon. As well as provide simulated p-values.

See also

Other stats: st_lag()

Examples

local_moran(guerry_nb$crime_pers, guerry_nb$nb, guerry_nb$wt)
#>              ii           eii       var_ii        z_ii        p_ii p_ii_sim
#> 1   0.522264520 -2.408047e-02 0.3258940389  0.95703705 0.338548553    0.360
#> 2   0.828016509  3.105957e-02 0.1272122969  2.23444829 0.025453591    0.028
#> 3   0.803539971 -3.987460e-03 0.1450022324  2.12065460 0.033950879    0.044
#> 4   0.741889657  3.976254e-03 0.2225556195  1.56417779 0.117775821    0.076
#> 5   0.231187184  1.730079e-03 0.0377776702  1.18054874 0.237782036    0.276
#> 6   0.838909799 -6.666156e-02 0.2865830301  1.69159909 0.090722441    0.108
#> 7   0.622605215 -9.351619e-02 1.2442898879  0.64198646 0.520881972    0.516
#> 8   1.646789439 -7.708404e-02 1.1107090107  1.63570598 0.101901138    0.104
#> 9  -0.019758073  7.642344e-04 0.0005011734 -0.91671043 0.359294397    0.404
#> 10  0.695261432  3.043380e-03 0.0635252403  2.74643777 0.006024632    0.012
#> 11  1.728228681 -4.462139e-02 0.3615186387  2.94853754 0.003192814    0.008
#> 12  0.831530992 -1.924987e-02 0.2574007981  1.67692164 0.093557806    0.068
#> 13 -0.216110795 -3.485924e-03 0.0341808624 -1.15006545 0.250116917    0.280
#> 14  0.294784885 -1.651847e-03 0.0110543556  2.81945587 0.004810514    0.008
#> 15 -0.187033812 -2.897899e-02 0.0922659616 -0.52033975 0.602826796    0.576
#> 16 -0.047760501  6.591588e-03 0.0055675095 -0.72842654 0.466352522    0.520
#> 17  0.252948279  5.635657e-03 0.0126876085  2.19561605 0.028119436    0.044
#> 18  0.055058947 -1.521321e-02 0.0633659047  0.27916148 0.780120902    0.780
#> 19  0.872358990 -4.721759e-02 0.3992400429  1.45536142 0.145569232    0.168
#> 20  0.845313303  6.452693e-02 0.4502980837  1.16354229 0.244609549    0.272
#> 21  0.544842074 -5.256889e-02 0.8790161461  0.63719852 0.523995538    0.504
#> 22 -0.051046792 -1.544307e-03 0.0062971672 -0.62381295 0.532750433    0.556
#> 23 -0.689130071 -1.580395e-02 0.6676122694 -0.82406849 0.409900645    0.404
#> 24  0.686933419 -1.257361e-02 0.1860041742  1.62192488 0.104819434    0.080
#> 25 -0.106623626  2.821987e-03 0.0912399294 -0.36233133 0.717104449    0.700
#> 26  0.039027064 -4.002331e-03 0.0063800086  0.53870947 0.590087340    0.604
#> 27  1.129525109  3.120290e-02 0.9436273603  1.13065342 0.258200993    0.276
#> 28  1.182045274 -4.575685e-02 0.1419146924  3.25922769 0.001117160    0.004
#> 29  0.163959819 -7.611761e-04 0.0048145826  2.37393943 0.017599437    0.020
#> 30  0.069859097 -3.666453e-03 0.0058109235  0.96452991 0.334780321    0.400
#> 31  0.021778578 -2.519572e-03 0.0809302554  0.08541177 0.931934033    0.916
#> 32  1.012163106 -5.855668e-02 0.2522501986  2.13186681 0.033017797    0.048
#> 33  0.279597476  7.134779e-03 0.0158028218  2.16740329 0.030204116    0.044
#> 34  0.428197017  2.489584e-02 0.4861576344  0.57841684 0.562982726    0.608
#> 35 -0.102477591 -1.514061e-03 0.0026260367 -1.97021732 0.048813469    0.060
#> 36  0.015833610 -6.073850e-03 0.0045715247  0.32401229 0.745928732    0.796
#> 37  0.561451620 -1.492566e-02 0.1478899084  1.49877894 0.133930990    0.148
#> 38 -0.027912803 -3.038966e-03 0.0239512297 -0.16072331 0.872311328    0.828
#> 39  0.112523886 -2.614343e-03 0.0054243212  1.56331627 0.117978224    0.112
#> 40 -0.083982431 -3.359011e-02 0.1621159520 -0.12515594 0.900400095    0.992
#> 41  0.285172503 -1.741375e-02 0.0615599074  1.21955171 0.222634862    0.244
#> 42 -0.049545329 -9.886557e-05 0.0019303732 -1.12541992 0.260411135    0.284
#> 43 -0.016027706 -3.539312e-03 0.0135392326 -0.10732714 0.914529451    0.916
#> 44  0.840170458 -4.246787e-02 0.6658084959  1.08170320 0.279384429    0.292
#> 45 -0.162657608  4.260103e-03 0.0316424446 -0.93835550 0.348061745    0.372
#> 46  1.616626620 -1.153486e-01 0.5160278502  2.41104380 0.015906938    0.016
#> 47  0.401435540 -2.206250e-03 0.2106435273  0.87947209 0.379145357    0.404
#> 48  0.872608337 -7.550110e-02 0.5033705248  1.33633265 0.181440569    0.220
#> 49 -0.471949223  1.721254e-03 0.0591416866 -1.94773319 0.051446897    0.068
#> 50  0.265466518 -1.132465e-02 0.1286539554  0.77168606 0.440300386    0.440
#> 51  1.441699896 -2.363008e-02 0.2651858469  2.84551097 0.004434023    0.008
#> 52 -0.383762557 -3.629025e-02 0.1817484500 -0.81505111 0.415043055    0.456
#> 53  0.392685859  8.569075e-03 0.0756353677  1.39669257 0.162506039    0.168
#> 54  0.319995929  2.483578e-03 0.0549454822  1.35454872 0.175561382    0.172
#> 55  0.069614844  1.858600e-02 0.6311830176  0.06423002 0.948787074    0.936
#> 56  0.410365993 -1.556149e-03 0.0854420288  1.40922183 0.158769585    0.160
#> 57  0.988650255  5.737763e-03 0.2606203940  1.92535429 0.054185050    0.084
#> 58  0.205022085  3.157640e-03 0.2053067850  0.44551074 0.655950699    0.696
#> 59  0.723039856 -1.080587e-02 0.2258413719  1.54419812 0.122540344    0.140
#> 60  0.608607689  2.916701e-02 0.1003802451  1.82887850 0.067417812    0.080
#> 61 -0.179708687 -9.149333e-04 0.0234758637 -1.16692126 0.243242169    0.284
#> 62  0.232341838 -6.865494e-03 0.0668863931  0.92492304 0.355005940    0.408
#> 63  0.287892902 -3.106831e-02 0.3521648027  0.53748321 0.590933881    0.624
#> 64  2.274753084 -3.391835e-02 1.5298598129  1.86653574 0.061966448    0.060
#> 65  0.539130024 -2.803069e-02 0.2604061834  1.11142586 0.266385086    0.284
#> 66  1.051798136  5.767215e-03 1.5783977497  0.83259979 0.405070479    0.444
#> 67 -0.131392170  2.350544e-03 0.0060086121 -1.72537320 0.084460238    0.088
#> 68  0.138190992 -8.946973e-04 0.0207867405  0.96469327 0.334698466    0.356
#> 69  1.046159211 -1.649873e-02 0.2014216127  2.36777515 0.017895408    0.036
#> 70  1.253265453 -4.535060e-02 0.5616496253  1.73279837 0.083131513    0.088
#> 71  0.299578515 -7.598486e-03 0.3112323719  0.55061281 0.581899122    0.632
#> 72 -0.169627902  4.206607e-03 0.0157624405 -1.38459981 0.166174871    0.144
#> 73 -0.042159110  8.469980e-03 0.0121083371 -0.46010597 0.645440157    0.704
#> 74  0.036829436 -1.518011e-03 0.1951306590  0.08681079 0.930821913    0.968
#> 75 -0.055736811 -4.437046e-03 0.0092728157 -0.53273295 0.594218454    0.528
#> 76  1.180394095 -3.011292e-02 0.6189671425  1.53862758 0.123895241    0.144
#> 77  0.782521216 -6.870006e-03 0.1737712568  1.89366574 0.058269392    0.064
#> 78  0.529916604 -9.555951e-03 0.0855055212  1.84489764 0.065052430    0.080
#> 79  0.861411539  1.698268e-03 0.2547629153  1.70327796 0.088516064    0.096
#> 80  0.895182573 -2.239064e-04 0.1314355344  2.46981165 0.013518421    0.020
#> 81  0.025800751  2.035884e-03 0.0040921060  0.37150267 0.710263167    0.708
#> 82 -0.330384096 -2.009793e-02 0.0793669109 -1.10139393 0.270725248    0.252
#> 83 -0.310472511  2.922122e-02 0.0426785634 -1.64430596 0.100113019    0.108
#> 84  0.001292507 -1.330070e-03 0.0038581747  0.04222185 0.966321841    0.972
#> 85 -0.126709946 -1.214443e-02 0.0154350808 -0.92214550 0.356452687    0.344
#>    p_folded_sim      skewness    kurtosis      mean    median     pysal
#> 1         0.180  0.0447839034  0.07467761 High-High High-High High-High
#> 2         0.014  0.0547195380  0.07060433 High-High High-High High-High
#> 3         0.022  0.1276143117 -0.14231488 High-High High-High High-High
#> 4         0.038 -0.1997153231 -0.23780937   Low-Low   Low-Low   Low-Low
#> 5         0.138 -0.2215406092 -0.28799341   Low-Low   Low-Low   Low-Low
#> 6         0.054  0.0003814484  0.51344578   Low-Low   Low-Low   Low-Low
#> 7         0.258  0.1975144354 -0.01339371 High-High High-High High-High
#> 8         0.052 -0.0936284407 -0.34746868   Low-Low   Low-Low   Low-Low
#> 9         0.202 -0.0882729254 -0.43594465  Low-High High-High  Low-High
#> 10        0.006 -0.1412852042  0.25813077   Low-Low   Low-Low   Low-Low
#> 11        0.004  0.0200481496 -0.30630176   Low-Low   Low-Low   Low-Low
#> 12        0.034 -0.1029220634 -0.26614907   Low-Low   Low-Low   Low-Low
#> 13        0.140 -0.0077300217 -0.29342101  Low-High  Low-High  Low-High
#> 14        0.004 -0.0609937674 -0.09585427   Low-Low   Low-Low   Low-Low
#> 15        0.288  0.0395798003  0.07762154  High-Low  High-Low  High-Low
#> 16        0.260  0.0390862060 -0.22764713  Low-High  Low-High  Low-High
#> 17        0.022  0.1263540354  0.02898633 High-High High-High High-High
#> 18        0.390  0.0844305385 -0.01082536   Low-Low   Low-Low   Low-Low
#> 19        0.084  0.1690310302 -0.18906547 High-High High-High High-High
#> 20        0.136  0.1279130074 -0.16833910 High-High High-High High-High
#> 21        0.252  0.1782153314 -0.06360293 High-High High-High High-High
#> 22        0.278  0.1256259076 -0.12225661  High-Low  High-Low  High-Low
#> 23        0.202 -0.0873245788 -0.18752595  Low-High  Low-High  Low-High
#> 24        0.040 -0.2407711578 -0.23937529   Low-Low   Low-Low   Low-Low
#> 25        0.350 -0.0713941348 -0.13466187  Low-High   Low-Low  Low-High
#> 26        0.302  0.1112572584 -0.25517140 High-High  High-Low High-High
#> 27        0.138  0.2417770828 -0.21910692 High-High High-High High-High
#> 28        0.002  0.0035827413 -0.21672509   Low-Low   Low-Low   Low-Low
#> 29        0.010 -0.1017911295  0.06941740   Low-Low   Low-Low   Low-Low
#> 30        0.200 -0.0591336906 -0.43403759   Low-Low   Low-Low   Low-Low
#> 31        0.458  0.1371605569 -0.19645816  High-Low  High-Low High-High
#> 32        0.024 -0.0496895491 -0.07597735   Low-Low   Low-Low   Low-Low
#> 33        0.022  0.1282138369 -0.20779758 High-High High-High High-High
#> 34        0.304 -0.0694930106 -0.37313303 High-High High-High High-High
#> 35        0.030 -0.1555370564  0.07442723  Low-High High-High  Low-High
#> 36        0.398 -0.1904590349 -0.27008184   Low-Low   Low-Low   Low-Low
#> 37        0.074  0.0533621755 -0.19010140 High-High High-High High-High
#> 38        0.414 -0.1359369486  0.17404428  Low-High   Low-Low  Low-High
#> 39        0.056  0.0282570519  0.37422615 High-High High-High High-High
#> 40        0.496  0.4441672088 -0.09366914  High-Low  High-Low  High-Low
#> 41        0.122 -0.1091864843 -0.38185845   Low-Low   Low-Low   Low-Low
#> 42        0.142 -0.1696748859 -0.10390946  Low-High High-High  Low-High
#> 43        0.458 -0.1015365790 -0.19500889   Low-Low   Low-Low  Low-High
#> 44        0.146 -0.1196930287 -0.20045504   Low-Low   Low-Low   Low-Low
#> 45        0.186  0.0469779705 -0.11097950  High-Low  High-Low  High-Low
#> 46        0.008 -0.1553046007  0.03528647   Low-Low   Low-Low   Low-Low
#> 47        0.202  0.2354218717 -0.25199426 High-High High-High High-High
#> 48        0.110  0.2714359288 -0.23872512 High-High High-High High-High
#> 49        0.034 -0.2994939928 -0.19289409  Low-High  Low-High  Low-High
#> 50        0.220  0.1921660142 -0.14487982 High-High High-High High-High
#> 51        0.004 -0.0681885595 -0.28326386 High-High High-High High-High
#> 52        0.228  0.1497041606 -0.43204095  High-Low  High-Low  High-Low
#> 53        0.084  0.1468295086  0.13984449 High-High High-High High-High
#> 54        0.086  0.2366817369 -0.05272854 High-High High-High High-High
#> 55        0.468 -0.1118999749 -0.19193833   Low-Low   Low-Low   Low-Low
#> 56        0.080  0.0646290251 -0.15386973 High-High High-High High-High
#> 57        0.042  0.2577646870 -0.36802220 High-High High-High High-High
#> 58        0.348  0.0841438856 -0.12179510 High-High  High-Low High-High
#> 59        0.070  0.0939878059 -0.30306676 High-High High-High High-High
#> 60        0.040  0.1242595109 -0.39989796 High-High High-High High-High
#> 61        0.142 -0.0145574956 -0.45461698  Low-High  Low-High  Low-High
#> 62        0.204  0.0054830270 -0.37601615   Low-Low   Low-Low   Low-Low
#> 63        0.312 -0.1414843747 -0.05093919   Low-Low   Low-Low   Low-Low
#> 64        0.030 -0.1729164733 -0.49003993   Low-Low   Low-Low   Low-Low
#> 65        0.142 -0.0519364125 -0.22207611   Low-Low   Low-Low   Low-Low
#> 66        0.222 -0.2501288374 -0.39333472   Low-Low   Low-Low   Low-Low
#> 67        0.044 -0.0657404983  0.02498504  Low-High High-High  Low-High
#> 68        0.178  0.2131337340 -0.24135823 High-High High-High High-High
#> 69        0.018  0.1411788429 -0.25037070 High-High High-High High-High
#> 70        0.044  0.1486030751 -0.20502785 High-High High-High High-High
#> 71        0.316 -0.0108257724 -0.61585230   Low-Low   Low-Low   Low-Low
#> 72        0.072 -0.1845987380  0.28888211  Low-High  Low-High  Low-High
#> 73        0.352  0.1095690674 -0.23483343  High-Low  High-Low  High-Low
#> 74        0.484  0.0445389239  0.05565743   Low-Low   Low-Low   Low-Low
#> 75        0.264 -0.0866064406 -0.13375645  Low-High  Low-High  Low-High
#> 76        0.072  0.0551602822 -0.14377869 High-High High-High High-High
#> 77        0.032 -0.0388671622  0.01361079   Low-Low   Low-Low   Low-Low
#> 78        0.040  0.0676668124 -0.24386037   Low-Low   Low-Low   Low-Low
#> 79        0.048  0.0021329633  0.10381406   Low-Low   Low-Low   Low-Low
#> 80        0.010  0.0586875582 -0.23181054   Low-Low   Low-Low   Low-Low
#> 81        0.354  0.0320591332 -0.25122083 High-High High-High High-High
#> 82        0.126  0.0079970199  0.06241232  Low-High  Low-High  Low-High
#> 83        0.054 -0.1306714360  0.08098407  Low-High  Low-High  Low-High
#> 84        0.486 -0.1981019244  0.20310852   Low-Low  High-Low   Low-Low
#> 85        0.172 -0.0545684047 -0.33928109  Low-High  Low-High  Low-High