Ripley’s K and Pair Correlation Function

Written by Jeff Gillan and Leandro Gonzalez

Other Names

K-Function, PCF


The Ripley’s K function (Eq. 1) is a spatial analysis method used to describe how point patterns occur over a given area of interest. Ripley’s K allows researchers to determine if the phenomenon of interest (e.g. trees,) appears to be dispersed, clustered, or randomly distributed throughout the study area. This method is similar to the Moran’s I function but is able to describe point patterns at multiple user defined scales.

Using an illustrative example, the Ripley’s K function is used to describe the point pattern of pine trees (Fig. 1). In this example, pine trees are represented by green dots and other tree species are represented by red dots. The function counts the number of neighboring pine trees found within a given distance of each individual pine tree (Xm). The number of observed neighboring pine trees is then traditionally compared to the number of pine trees one would expect to find based on a completely spatially random point pattern. If the number of pines found within a given distance of each individual pine is greater than that for a random distribution, the distribution is clustered. If the number is smaller, the distribution is dispersed.

Ripley’s K function is generally calculated at multiple distances allowing you to see how point pattern distributions can change with scale. For example, at near distances, the points could cluster, while at farther distances, points could be dispersed (Fig. 2).

Ripley’s K function can be calculated in a univariate form where you are describing the spatial pattern of only pine trees (described above). Alternatively, K can be calculated in a bivariate form where you interested in the spatial pattern of pine trees compared with other species of trees. The computation is the same except the function counts the number of neighboring other trees found within a given distance of each individual pine tree.

Eq.1. Ripley’s K function formula, where n is the sample size, A is the area of the plot, wij corrects for edge effect, It is a value of one if the distance between features is less than or equal to t (a circle of radius), otherwise it is zero.

Table 1. Summary of Ripley’s K function.

Statistic Method Significance test Advantages Disadvantages
K- Function (Ripley’s K) Counting the number of features within defined distances Uses multiple simulations to create a random distribution envelope Calculates the concentration of features at a range of scales or distances, simultaneously Patterns are suspect at larger distances due to edge effects

Pair Correlation Function (PCF)

The PCF is a variation of Ripley’s K which measures spatial association within rings rather than cumulative circles (Fig. 3). In a Ripley’s K analysis, the results at larger distances are influenced by the shorter distances which may obscure the spatial association at any given scale. For example, the K function is only able to analyze all the points within 500 m, whereas the PCF can analyze the point pattern between 250 and 500 m. The method you choose will depend on your specific question.

In the bivariate form, the PCF is defined (Eq. 2) (Stoyan and Stoyan 1994)

Eq 2. PCF Formula. where ĝ_12 (r) is the PCF at a specified radius, A is the total point pattern area, n_1 and n_2 are the number of points of type 1 and points of type 2, respectively. The x_i are locations of points of type 1, y_i are the locations of points of type2 , and w_ij is a weighting function that accounts for edge effect bias created by unobservable man-made feature points outside the study area.

The PCF looks at a neighborhood of points surrounding the specified radius and gives greater weight to points near the radius and less weight to points further away. This type of weighting is known as an Epanečnikov kernel and is specified by k_h, where h is the bandwidth parameter specifying the size of the radius neighborhood that will receive weighting. Points lying outside the bandwidth will not be considered in the calculation at that radius.

Rangeland Examples

Feagin and Wu. 2007. Mapped the topographical contours of the sand dunes in Galveston island, TX as a first-order effect to describe the spatial distribution of environmental stress, and quantified the second-order within- and between-group associations of the plants within specific bands of these contours using Ripley’s K analysis.

Fonton et al. 2011. Determined the optimal plot size required to analyze and accurately represent the spatial patterns of trees in the Sudanian woodlands’ region.

Dickinson and Norton. 2011. Used Ripley’s K, inhomogeneous Ripley’s K and inhomogeneous pair correlation functions to detect patterns of aggregation, regularity and not significantly different from random in the Festuca tussock grasslands.

Strand et al. 2007. Used the Ripley’s K function and the pair correlation function to assess the spatial pattern of expanding juniper in southwestern Idaho.

References for Rangeland Studies

Dickinson Y and Norton D. 2011. Divergent small-scale spatial patterns in New Zealand’s short tussock grasslands. In NEW ZEALAND JOURNAL OF ECOLOGY. 35(1): 76-82.

Feagin R. and Wu X. 2007. The Spatial Patterns of Functional Groups and Successional Direction in a Coastal Dune Community. In Rangeland Ecology & Management. 60 (4): 417-425.

Fonton N, Atindogbe G, Honkonnou N, and Dohou R. 2011. Plot size for modeling the spatial structure of Sudanian woodland trees. In ANNALS OF FOREST SCIENCE. 68(8): 1315-1321.

Strand, E. K., A. P. Robinson, and S. C. Bunting. 2007. Spatial patterns on the sagebrush steppe/western juniper ecotone. Plant Ecology. 190: 159-173.

Software/hardware Requirements

Ripley’s K analysis can be performed in several GIS and statistical applications like ESRI’s ArcGIS Spatial Analyst or Spatstat in R.


Graph/scatterplot along with a table containing Ripley’s K coefficients at different distance intervals. The intervals are selected by the user before running the K-function.

Technical References

Baddeley, A. and R. Turner. 2005. Spatstat: an R package for analyzing spatial point pattern. Journal of Statistical Software 12: 1-42.

ESRI. 2010. Arc GIS Resource Center. On [WWW] at ESRI Resource Center

Mitchell, A. 2009. The ESRI Guide to GIS Analysis. Volume 2: Spatial Measurements and Statistics. Redlands, CA: Esri Press.

Stoyan, D., and H. Stoyan. 1994. Fractals, random shapes, and point fields: methods of geometrical statistics. Wiley, Chichester, UK.

Comments are closed.