Global Join Count Permutation Test
Global Join Count Test
Usage
global_jc_perm(
fx,
nb,
wt,
alternative = "greater",
nsim = 499,
allow_zero = FALSE,
...
)
global_jc_test(fx, nb, wt, alternative = "greater", allow_zero = NULL, ...)
Arguments
- fx
a factor or character vector of the same length as nb.
- 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
number of simulations to run.
- allow_zero
If
TRUE
, assigns zero as lagged value to zone without neighbors.- ...
additional arguments passed to
spdep::joincount.test()
Examples
geo <- sf::st_geometry(guerry)
nb <- st_contiguity(geo)
wt <- st_weights(nb, style = "B")
fx <- guerry$region
global_jc_perm(fx, nb, wt)
#>
#> Monte-Carlo simulation of join-count statistic
#>
#> data: fx
#> weights: listw
#> number of simulations + 1: 500
#>
#> Join-count statistic for C = 35, rank of observed statistic = 500,
#> p-value = 0.002
#> alternative hypothesis: greater
#> sample estimates:
#> mean of simulation variance of simulation
#> 8.006012 6.066229
#>
#>
#> Monte-Carlo simulation of join-count statistic
#>
#> data: fx
#> weights: listw
#> number of simulations + 1: 500
#>
#> Join-count statistic for E = 29, rank of observed statistic = 500,
#> p-value = 0.002
#> alternative hypothesis: greater
#> sample estimates:
#> mean of simulation variance of simulation
#> 8.074148 6.980435
#>
#>
#> Monte-Carlo simulation of join-count statistic
#>
#> data: fx
#> weights: listw
#> number of simulations + 1: 500
#>
#> Join-count statistic for N = 29, rank of observed statistic = 500,
#> p-value = 0.002
#> alternative hypothesis: greater
#> sample estimates:
#> mean of simulation variance of simulation
#> 8.064128 6.325197
#>
#>
#> Monte-Carlo simulation of join-count statistic
#>
#> data: fx
#> weights: listw
#> number of simulations + 1: 500
#>
#> Join-count statistic for S = 32, rank of observed statistic = 500,
#> p-value = 0.002
#> alternative hypothesis: greater
#> sample estimates:
#> mean of simulation variance of simulation
#> 7.765531 5.778247
#>
#>
#> Monte-Carlo simulation of join-count statistic
#>
#> data: fx
#> weights: listw
#> number of simulations + 1: 500
#>
#> Join-count statistic for W = 31, rank of observed statistic = 500,
#> p-value = 0.002
#> alternative hypothesis: greater
#> sample estimates:
#> mean of simulation variance of simulation
#> 7.949900 6.778609
#>
global_jc_test(fx, nb, wt)
#>
#> Join count test under nonfree sampling
#>
#> data: fx
#> weights: listw
#>
#> Std. deviate for C = 10.886, p-value < 2.2e-16
#> alternative hypothesis: greater
#> sample estimates:
#> Same colour statistic Expectation Variance
#> 35.000000 8.000000 6.151883
#>
#>
#> Join count test under nonfree sampling
#>
#> data: fx
#> weights: listw
#>
#> Std. deviate for E = 8.4667, p-value < 2.2e-16
#> alternative hypothesis: greater
#> sample estimates:
#> Same colour statistic Expectation Variance
#> 29.000000 8.000000 6.151883
#>
#>
#> Join count test under nonfree sampling
#>
#> data: fx
#> weights: listw
#>
#> Std. deviate for N = 8.4667, p-value < 2.2e-16
#> alternative hypothesis: greater
#> sample estimates:
#> Same colour statistic Expectation Variance
#> 29.000000 8.000000 6.151883
#>
#>
#> Join count test under nonfree sampling
#>
#> data: fx
#> weights: listw
#>
#> Std. deviate for S = 9.6763, p-value < 2.2e-16
#> alternative hypothesis: greater
#> sample estimates:
#> Same colour statistic Expectation Variance
#> 32.000000 8.000000 6.151883
#>
#>
#> Join count test under nonfree sampling
#>
#> data: fx
#> weights: listw
#>
#> Std. deviate for W = 9.2731, p-value < 2.2e-16
#> alternative hypothesis: greater
#> sample estimates:
#> Same colour statistic Expectation Variance
#> 31.000000 8.000000 6.151883
#>