cross_k_function#
- cross_k_function(domain, population_A, population_B, include_boundaries=None, exclude_boundaries=None, distance_metric='euclidean', max_R=100, step=10, boundary_exclude_distance=0, exclude_zero=False, remain_within_connected_component=False, return_confidence_interval=False, visualise_output=False, visualise_spatial_statistic_kwargs={})#
Calculate Ripley’s K function between population_A and population_B. If boundaries are specified, restrict analysis to those populations within the boundary and correct for edge effects. Note that if there are multiple disjoint boundary regions, the distance between points in different regions is still calculated according to the distance_metric and used in the K-function calculation.
- Parameters:
- domainobject
The spatial domain containing the populations and boundaries.
- population_Aarray-like or query-like
The first population of points or a query to select the points.
- population_Barray-like or query-like
The second population of points or a query to select the points.
- include_boundariesarray-like, query-like, or None, optional
Boundaries to include in the analysis. Defaults to None.
- exclude_boundariesarray-like, query-like, or None, optional
Boundaries to exclude from the analysis. Defaults to None.
- distance_metricstr, optional
The distance metric to use. Defaults to ‘euclidean’.
- max_Rfloat, optional
The maximum radius to consider. Defaults to 100.
- stepfloat, optional
The step size for the radius. Defaults to 10.
- boundary_exclude_distancefloat, optional
Distance to exclude from the domain boundary. Defaults to 0.
- exclude_zerobool, optional
Whether to exclude zero distances. Defaults to False.
- remain_within_connected_componentbool, optional
Whether to remain within the connected component. Defaults to False.
- return_confidence_intervalbool, optional
Return a 95% confidence interval around the K function. Defaults to False.
- visualise_outputbool, optional
If True, call “visualise_spatial_statistic” to generate a plot of the K function. Defaults to False.
- visualise_spatial_statistic_kwargsdict, optional
Arguments to pass to visualise_spatial_statistic if visualise_output is True.
- Raises
- ——
- ValueError
If the query provided for population_A is not of the correct type.
- ValueError
If the query provided for population_B is not of the correct type.
- ValueError
If the query provided for include_boundaries is not of the correct type.
- ValueError
If the query provided for exclude_boundaries is not of the correct type.
- NotImplementedError
If remain_within_connected_component is True.
- Returns:
- radiindarray
The radii considered in the analysis.
- cross_K_A_to_Bndarray
The calculated cross-K function values.
Notes
For more information on Ripley’s K function, see https://link.springer.com/content/pdf/10.1007/978-3-540-38175-4_1.pdf.