A simple function to compute the generalised BB join count statistic for k-coloured factors, called by joincount.test and joincount.mc;
$$BB = \sum_{i=1}^{n}\sum_{j=1}^{n}w_{ij} x_i x_j$$
Usage
joincount(dums, listw)
Arguments
dums
a matrix of binary dummy variables created from a factor
listw
a listw object created for example by nb2listw
Value
a vector of the raw weighted count sums for each level of the factor
References
Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, p. 17.