Skip to contents

Local G

Usage

local_g(x, nb, wt, alternative = "two.sided", ...)

local_g_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() or spdep::localG_perm()

nsim

The number of simulations to run.

Examples

x <- guerry$crime_pers
nb <- st_contiguity(guerry)
wt <- st_weights(nb)

res <- local_g_perm(x, nb, wt)

head(res)
#>            gi       e_gi       var_gi    p_value p_sim p_folded_sim    skewness
#> 1 0.013819020 0.01179804 4.551534e-06 0.34349027 0.344        0.172  0.10790963
#> 2 0.016115180 0.01172409 3.014116e-06 0.01143059 0.012        0.006  0.04274832
#> 3 0.015686557 0.01185348 2.882439e-06 0.02396408 0.036        0.018  0.01727164
#> 4 0.008553106 0.01183378 4.896809e-06 0.13819658 0.136        0.068  0.26293717
#> 5 0.008955895 0.01170787 6.125338e-06 0.26616647 0.248        0.124  0.20343595
#> 6 0.009334367 0.01183751 2.835467e-06 0.13713926 0.156        0.078 -0.05963516
#>     kurtosis
#> 1 -0.1836445
#> 2 -0.1668182
#> 3  0.1993352
#> 4 -0.3093248
#> 5 -0.1829702
#> 6 -0.1593033