Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

distcdf

Distribution Function of Interpoint Distance


Description

Computes the cumulative distribution function of the distance between two independent random points in a given window or windows.

Usage

distcdf(W, V=W, ..., dW=1, dV=dW, nr=1024, regularise=TRUE)

Arguments

W

A window (object of class "owin") containing the first random point.

V

Optional. Another window containing the second random point. Defaults to W.

...

Arguments passed to as.mask to determine the pixel resolution for the calculation.

dV, dW

Optional. Probability densities (not necessarily normalised) for the first and second random points respectively. Data in any format acceptable to as.im, for example, a function(x,y) or a pixel image or a numeric value. The default corresponds to a uniform distribution over the window.

nr

Integer. The number of values of interpoint distance r for which the CDF will be computed. Should be a large value!

regularise

Logical value indicating whether to smooth the results for very small distances, to avoid discretisation artefacts.

Details

This command computes the Cumulative Distribution Function CDF(r) = Prob(T ≤ r) of the Euclidean distance T = |X1-X2| between two independent random points X1 and X2.

In the simplest case, the command distcdf(W), the random points are assumed to be uniformly distributed in the same window W.

Alternatively the two random points may be uniformly distributed in two different windows W and V.

In the most general case the first point X1 is random in the window W with a probability density proportional to dW, and the second point X2 is random in a different window V with probability density proportional to dV. The values of dW and dV must be finite and nonnegative.

The calculation is performed by numerical integration of the set covariance function setcov for uniformly distributed points, and by computing the covariance function imcov in the general case. The accuracy of the result depends on the pixel resolution used to represent the windows: this is controlled by the arguments ... which are passed to as.mask. For example use eps=0.1 to specify pixels of size 0.1 units.

The arguments W or V may also be point patterns (objects of class "ppp"). The result is the cumulative distribution function of the distance from a randomly selected point in the point pattern, to a randomly selected point in the other point pattern or window.

If regularise=TRUE (the default), values of the cumulative distribution function for very short distances are smoothed to avoid discretisation artefacts. Smoothing is applied to all distances shorter than the width of 7 pixels.

Value

An object of class "fv", see fv.object, which can be plotted directly using plot.fv.

Author(s)

and Rolf Turner r.turner@auckland.ac.nz

See Also

Examples

# The unit disc
 B <- disc()
 plot(distcdf(B))

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.