J_function#

J_function(domain, population, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0, radius_step=10, iterations=50, remain_within_connected_component=False, as_hardcore=False, hardcore_radius=1, visualise_output=False, visualise_spatial_statistic_kwargs={})#

Calculate the J-function for a given spatial point pattern. The J-function is a non-parametric test for identifying clustering and dispersion in point patterns. The J-function compares the cumulative density functions (CDFs) of the spherical contact distribution, F(r), and the nearest-neighbour distribution function, G(r). The J-function is defined as J(r)= (1− G(r))/(1− F(r)). If J(r) > 1 then more points are found in a circle of radius, r, placed randomly in the domain than in a circle centred at one of the points, indicating dispersal of points within the point cloud. If J(r) < 1 then a disc of radius r centred on a point contains more points than a randomly placed disc, indicating clustering of points.

Parameters:
domainmuspan Domain object

The domain in which the point pattern is observed.

populationquery-like, optional

Query-like specifying the population of objects to analysis. Can be a list or array of object indices, a muspan query, or None to include all objects. Default is None.

include_boundariesquery-like, optional

Query specifying the external boundaries to run computations within. Can be a list or array of object indices, a muspan query, or None to use the entire domain. Default is None.

exclude_boundariesquery-like, optional

Query specifying the internal boundaries (i.e., excluded regions within the shapes defined by include_boundaries) within which to exclude from analyse. Can be a list or array of object indices, a muspan query, or None. Default is None.

boundary_exclude_distancefloat, optional

Buffer to exclude objects located within boundary_exclude_distance from the boundaries. Defaults to 0.

radius_stepfloat, optional

Step size for the radius. Default is 10.

iterationsint, optional

Number of realisations of the SCD to compute the J-function on. Default is 50.

remain_within_connected_componentbool, optional

Whether to remain within the connected component of the domain. Default is False.

as_hardcorebool, optional

If True, randomly sampled points are placed using a hardcore process in the spherical contact distribution. Default is False.

hardcore_radiusfloat, optional

The hardcore radius for the hardcore process such that no two random points are closer than 2 * hardcore_radius in the spherical contact distribution. Default is 10.

visualise_outputbool, optional

If True, call “visualise_spatial_statistic” to generate a plot of the J function. Defaults to False.

visualise_spatial_statistic_kwargsdict, optional

Arguments to pass to visualise_spatial_statistic if visualise_output is True.

Returns:
radiusnumpy.ndarray

Array of radius values.

J_rnumpy.ndarray

Array of J-function values corresponding to the radius values.