Learn R Programming

spatstat.explore (version 3.5-2)

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, savedenom=FALSE, delta=NULL)

Arguments

Value

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

Details

This command computes the Cumulative Distribution Function \( CDF(r) = Prob(T \le r) \) of the Euclidean distance \(T = \|X_1 - X_2\|\) between two independent random points \(X_1\) and \(X_2\).

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 \(X_1\) is random in the window W with a probability density proportional to dW, and the second point \(X_2\) 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 10 pixels.

Numerical accuracy of some calculations requires very fine spacing of the values of the function argument r. If the argument delta is given, then after the cumulative distribution function has been calculated, it will be interpolated onto a finer grid of r values with spacing less than or equal to delta.

See Also

setcov, as.mask.

Examples

Run this code
 # The unit disc
 B <- disc()
 plot(distcdf(B))

Run the code above in your browser using DataLab