The univariate local join count statistic is used to identify clusters of rarely occurring binary variables. The binary variable of interest should occur less than half of the time.

local_joincount_uni(
  fx,
  chosen,
  listw,
  alternative = "two.sided",
  nsim = 199,
  iseed = NULL,
  no_repeat_in_row=FALSE
)

Arguments

fx

a binary variable either numeric or logical

chosen

a scalar character containing the level of fx that should be considered the observed value (1).

listw

a listw object containing binary weights created, for example, with nbwlistw(nb, style = "B")

alternative

default "greater". One of "less" or "greater".

nsim

the number of conditional permutation simulations

iseed

default NULL, used to set the seed for possible parallel RNGs

no_repeat_in_row

default FALSE, if TRUE, sample conditionally in each row without replacements to avoid duplicate values, https://github.com/r-spatial/spdep/issues/124

Value

a data.frame with two columns BB and Pr() and number of rows equal to the length of x.

Details

The local join count statistic requires a binary weights list which can be generated with nb2listw(nb, style = "B"). Additionally, ensure that the binary variable of interest is rarely occurring in no more than half of observations.

P-values are estimated using a conditional permutation approach. This creates a reference distribution from which the observed statistic is compared. For more see Geoda Glossary.

References

Anselin, L., & Li, X. (2019). Operational Local Join Count Statistics for Cluster Detection. Journal of geographical systems, 21(2), 189–210. doi:10.1007/s10109-019-00299-x

Author

Josiah Parry josiah.parry@gmail.com

Examples

data(oldcol)
fx <- as.factor(ifelse(COL.OLD$CRIME < 35, "low-crime", "high-crime"))
listw <- nb2listw(COL.nb, style = "B")
set.seed(1)
(res <- local_joincount_uni(fx, chosen = "high-crime", listw))
#>    BB Pr(z != E(BBi))
#> 1   0              NA
#> 2   0              NA
#> 3   4            0.50
#> 4   0              NA
#> 5   0              NA
#> 6   0              NA
#> 7   4            0.89
#> 8   0              NA
#> 9   5            0.11
#> 10  0              NA
#> 11  0              NA
#> 12  0              NA
#> 13  0              NA
#> 14  0              NA
#> 15  0              NA
#> 16  0              NA
#> 17  0              NA
#> 18  0              NA
#> 19  0              NA
#> 20  3            0.55
#> 21  2            0.84
#> 22  3            0.30
#> 23  4            0.61
#> 24  5            0.12
#> 25  0              NA
#> 26  0              NA
#> 27  0              NA
#> 28  0              NA
#> 29  3            0.98
#> 30  5            0.09
#> 31  8            0.01
#> 32  7            0.02
#> 33  6            0.02
#> 34  5            0.04
#> 35  7            0.03
#> 36  8            0.02
#> 37  6            0.05
#> 38  5            0.04
#> 39  3            0.44
#> 40  5            0.14
#> 41  3            0.13
#> 42  5            0.05
#> 43  2            0.63
#> 44  0              NA
#> 45  0              NA
#> 46  0              NA
#> 47  0              NA
#> 48  0              NA
#> 49  0              NA