3.4 Local Join Count

Local join count (2019) is a local spatial autocorrelation statistic for binary variables (e.g. 0 and 1). It can be used to identify co-occurrences of uncommon events, i.e., situations where observations that take on the value of 1 constitute much less than half of the sample. For more information, please read http://geodacenter.github.io/workbook/6a_local_auto/lab6a.html

local_joincount()

local_joincount() is a PostgreSQL WINDOW function. Please call it with an OVER clause.

Synopsis

Short version:

float[] local_joincount(numeric val,  bytea weights)

Full version:

float[] local_joincount(numeric val,  bytea weights,
    integer permutations, 
    character varying permutation_method,
    float significance_cutoff, 
    integer cpu_threads, 
    integer seed)

Arguments

Name

Type

Description

val

numeric

the numeric column that contains the binary values (e.g. 0 and 1) for LISA statistics

weights

bytea

the bytea column that stores the spatial weights information

permutations

integer

the number of permutations for the LISA computation. Default: 999.

permutation_method

character varying

the permutation method used for the LISA computation. Options are 'complete', 'lookup'. Default: 'lookup'.

significance_cutoff

float

the cutoff value for significance p-values to filter not-significant clusters. Default: 0.05.

cpu_threads

integer

the number of cpu threads used for parallel LISA computation. Default: 6.

seed

integer

the seed for random number generator used in LISA statistics. Default: 123456789.

Return

Type

Description

float[]

an array contains 3 values, which are {'local join count', 'pseudo-p value', 'number of neighbors'}

The results do NOT have 'category indicator'.

Examples

Apply local join count statistics on the variable "death_dum" (dummy variable for death incidence, dataset 'deaths_nd_by_house') using distance-based weights "d20" (distance cutoff value = 20 meters):

  • Create weights:

-- add a new column 'd20' first
-- ALTER TABLE deaths_nd_by_house ADD COLUMN d20 bytea
UPDATE deaths_nd_by_house SET d20 = w.distance_weights
FROM (
  SELECT 
    gid, 
    distance_weights(gid, ST_Transform(the_geom, 27700), 20.0) 
  OVER() FROM deaths_nd_by_house
) AS w 
WHERE deaths_nd_by_house.gid = w.gid

When importing the dataset to PostgresSQL, the projection could be changed (e.g. using EPSG: 4326). In this example, we need to use ST_Transform(geom, srid) to project the points from EPSG 4326 to EPSG 27700 (unit: meter) so that we can create a distance weights using 20.0 meters as the cutoff value.

  • apply local_joincount()

SELECT local_joincount(death_dum, d20) OVER() FROM deaths_nd_by_house;

 local_joincount 
-----------------
 {0,-1,11}
 {0,-1,11}
 {0,-1,12}
 {0,-1,12}
 {7,0.009,14}
 {6,0.021,12}
 {7,0.005,13}
 {5,0.079,13}
 ...

One can extract the pseudo-p values and make a significance map of local join count

SELECT tmp.local_joincount[2] FROM (
    SELECT local_joincount(death_dum, d20) OVER() FROM deaths_nd_by_house
) AS tmp;

Last updated