Local G*
Usage
local_gstar(x, nb, wt, alternative = "two.sided", ...)
local_gstar_perm(x, nb, wt, nsim = 499, alternative = "two.sided", ...)
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.- ...
methods passed to
spdep::localG()
orspdep::localG_perm()
- nsim
The number of simulations to run.
Examples
nb <- st_contiguity(guerry)
wt <- st_weights(nb)
x <- guerry$crime_pers
res <- local_gstar_perm(x, nb, wt)
#> ! attr `self.include` is `TRUE`. Reporting Gi*.
head(res)
#> gi e_gi var_gi p_value p_sim p_folded_sim
#> 1 0.014270222 0.01179363 3.999492e-06 0.21557727 0.216 0.108
#> 2 0.015807678 0.01186898 2.506075e-06 0.01284523 0.012 0.006
#> 3 0.015485705 0.01192133 2.722357e-06 0.03075060 0.036 0.018
#> 4 0.008315062 0.01198064 3.225991e-06 0.04126587 0.032 0.016
#> 5 0.009224485 0.01192153 4.204037e-06 0.18837800 0.184 0.092
#> 6 0.008819945 0.01189878 2.285133e-06 0.04167834 0.052 0.026
#> skewness kurtosis
#> 1 -0.083372329 -0.21182439
#> 2 0.049050892 -0.01355217
#> 3 -0.003487987 0.20651203
#> 4 0.217354565 -0.17467120
#> 5 0.143433765 -0.00448736
#> 6 -0.135248582 -0.13457861
res <- local_gstar(x, nb, wt)
#> ! attr `self.include` is `TRUE`. Reporting Gi*.
head(res)
#> [1] 1.342359 2.595578 2.388872 -1.848187 -1.209736 -2.034142