Learn R Programming

spatstat.explore (version 3.3-1)

pairMean: Mean of a Function of Interpoint Distance

Description

Computes the mean value, or the double integral, of a specified function of the distance between two independent random points in a given window or windows.

Usage

pairMean(fun, W, V = NULL, ..., normalise = TRUE)

Value

A single numeric value.

Arguments

fun

A function in the R language which takes one argument.

W

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

V

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

...

Further optional arguments passed to distcdf to determine the pixel resolution for the calculation and the probability distributions of the random points.

normalise

Logical value specifying whether to calculate the mean value (normalise=TRUE, the default) or the double integral (normalise=FALSE).

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au.

Details

This command computes the mean value of fun(T) where T is the Euclidean distance \(T = \|X_1 - X_2\|\) between two independent random points \(X_1\) and \(X_2\).

In the simplest case, the command pairMean(fun, 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. Other options are described in distcdf.

The algorithm uses distcdf to compute the cumulative distribution function of T, and stieltjes to compute the mean value of fun(T).

If normalise=TRUE (the default) the result is the mean value of fun(T). If normalise=FALSE the result is the double integral.

See Also

distcdf

Examples

Run this code
   pairMean(function(d) { d^2 }, disc())

Run the code above in your browser using DataLab