# RipleysKEstimator¶

class astropy.stats.RipleysKEstimator(area, x_max=None, y_max=None, x_min=None, y_min=None)[source]

Bases: object

Estimators for Ripley’s K function for two-dimensional spatial data. See , , , ,  for detailed mathematical and practical aspects of those estimators.

Parameters
areafloat

Area of study from which the points where observed.

x_max, y_maxfloat, float, optional

Maximum rectangular coordinates of the area of study. Required if mode == 'translation' or mode == ohser.

x_min, y_minfloat, float, optional

Minimum rectangular coordinates of the area of study. Required if mode == 'variable-width' or mode == ohser.

References

1

Peebles, P.J.E. The large scale structure of the universe. <http://adsabs.harvard.edu/cgi-bin/nph-bib_query?bibcode=1980lssu.book…..P&db_key=AST>

2

Spatial descriptive statistics. <https://en.wikipedia.org/wiki/Spatial_descriptive_statistics>

3

Package spatstat. <https://cran.r-project.org/web/packages/spatstat/spatstat.pdf>

4

Cressie, N.A.C. (1991). Statistics for Spatial Data, Wiley, New York.

5

Stoyan, D., Stoyan, H. (1992). Fractals, Random Shapes and Point Fields, Akademie Verlag GmbH, Chichester.

Examples

>>> import numpy as np
>>> from matplotlib import pyplot as plt
>>> from astropy.stats import RipleysKEstimator
>>> z = np.random.uniform(low=5, high=10, size=(100, 2))
>>> Kest = RipleysKEstimator(area=25, x_max=10, y_max=10,
... x_min=5, y_min=5)
>>> r = np.linspace(0, 2.5, 100)
>>> plt.plot(r, Kest.poisson(r))


Attributes Summary

Methods Summary

 Hfunction(data, radii[, mode]) Evaluates the H function at radii. Lfunction(data, radii[, mode]) Evaluates the L function at radii. __call__(data, radii[, mode]) Call self as a function. evaluate(data, radii[, mode]) Evaluates the Ripley K estimator for a given set of values radii. poisson(radii) Evaluates the Ripley K function for the homogeneous Poisson process, also known as Complete State of Randomness (CSR).

Attributes Documentation

area
x_max
x_min
y_max
y_min

Methods Documentation

Hfunction(data, radii, mode='none')[source]

Evaluates the H function at radii. For parameter description see evaluate method.

Lfunction(data, radii, mode='none')[source]

Evaluates the L function at radii. For parameter description see evaluate method.

__call__(data, radii, mode='none')[source]

Call self as a function.

evaluate(data, radii, mode='none')[source]

Evaluates the Ripley K estimator for a given set of values radii.

Parameters
data2D array

Set of observed points in as a n by 2 array which will be used to estimate Ripley’s K function.

Set of distances in which Ripley’s K estimator will be evaluated. Usually, it’s common to consider max(radii) < (area/2)**0.5.

modestr

Keyword which indicates the method for edge effects correction. Available methods are ‘none’, ‘translation’, ‘ohser’, ‘var-width’, and ‘ripley’.

• ‘none’

this method does not take into account any edge effects whatsoever.

• ‘translation’

computes the intersection of rectangular areas centered at the given points provided the upper bounds of the dimensions of the rectangular area of study. It assumes that all the points lie in a bounded rectangular region satisfying x_min < x_i < x_max; y_min < y_i < y_max. A detailed description of this method can be found on ref .

• ‘ohser’

this method uses the isotropized set covariance function of the window of study as a weight to correct for edge-effects. A detailed description of this method can be found on ref .

• ‘var-width’

this method considers the distance of each observed point to the nearest boundary of the study window as a factor to account for edge-effects. See  for a brief description of this method.

• ‘ripley’

this method is known as Ripley’s edge-corrected estimator. The weight for edge-correction is a function of the proportions of circumferences centered at each data point which crosses another data point of interest. See  for a detailed description of this method.

Returns
ripley1D array

Ripley’s K function estimator evaluated at radii.

poisson(radii)[source]

Evaluates the Ripley K function for the homogeneous Poisson process, also known as Complete State of Randomness (CSR).

Parameters
Ripley’s K function evaluated at radii.