pairMean | R Documentation |
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.
pairMean(fun, W, V = NULL, ..., normalise = TRUE)
fun |
A function in the R language which takes one argument. |
W |
A window (object of class |
V |
Optional. Another window containing the second random point.
Defaults to |
... |
Further optional arguments passed to |
normalise |
Logical value specifying whether to calculate the mean
value ( |
This command computes the mean value of
fun(T)
where T
is
the Euclidean distance T = |X1-X2|
between two independent random points X1 and X2.
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.
A single numeric value.
.
distcdf
pairMean(function(d) { d^2 }, disc())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.