Computes nearest-neighbour correlation indices of a marked point
pattern, including the nearest-neighbour mark product index
(default case of nncorr
),
the nearest-neighbour mark index (nnmean
),
and the nearest-neighbour variogram index (nnvario
).
nncorr(X,
f = function(m1, m2) { m1 * m2 },
k = 1,
…,
use = "all.obs", method = c("pearson", "kendall", "spearman"),
denominator=NULL)
nnmean(X, k=1)
nnvario(X, k=1)
The observed point pattern.
An object of class "ppp"
.
Function X
.
Integer. The k
-th nearest neighbour of each point will be used.
Extra arguments passed to f
.
Arguments passed to the standard correlation function cor
.
Internal use only.
Labelled vector of length 2 or 3 containing the unnormalised and normalised nearest neighbour correlations, and the classical correlation if appropriate. Alternatively a matrix with 2 or 3 rows, containing this information for each mark variable.
The nearest neighbour correlation index
The command nncorr
computes the nearest neighbour correlation index
based on any test function f
provided by the user.
The default behaviour of nncorr
is to compute the
nearest neighbour mark product index.
The commands nnmean
and nnvario
are
convenient abbreviations for other special choices of f
.
In the default case, nncorr(X)
computes three different
versions of the nearest-neighbour correlation index:
the unnormalised, normalised, and classical correlations.
The unnormalised nearest neighbour correlation (Stoyan and Stoyan,
1994, section 14.7) is defined as
Here
Note that
We can define a normalised nearest neighbour correlation
by
X
are independent
and identically distributed, then
Finally if the marks of X
are real numbers,
we can also compute the
classical correlation, that is, the correlation coefficient
of the two random variables
In the default case where f
is not given,
nncorr(X)
computes
If the marks of X
are real numbers,
the unnormalised and normalised
versions of the nearest-neighbour product index
If the marks of X
are factor valued,
the unnormalised and normalised
versions of the nearest-neighbour equality index
The wrapper functions nnmean
and nnvario
compute the correlation indices for two special choices of the
function
nnmean
computes the correlation indices for
nnvario
computes the correlation indices for
The argument X
must be a point pattern (object of class
"ppp"
) and must be a marked point pattern.
(The marks may be a data frame, containing several columns of mark variables;
each column is treated separately.)
If the argument f
is given, it
must be a function, accepting two arguments m1
and m2
which are vectors of equal length containing mark
values (of the same type as the marks of X
).
It must return a vector of numeric
values of the same length as m1
and m2
.
The values must be non-negative.
The arguments use
and method
control
the calculation of the classical correlation using cor
,
as explained in the help file for cor
.
Other arguments may be passed to f
through the ...
argument.
This algorithm assumes that X
can be treated
as a realisation of a stationary (spatially homogeneous)
random spatial point process in the plane, observed through
a bounded window.
The window (which is specified in X
as Window(X)
)
may have arbitrary shape.
Biases due to edge effects are
treated using the ‘border method’ edge correction.
Stoyan, D. and Stoyan, H. (1994) Fractals, random shapes and point fields: methods of geometrical statistics. John Wiley and Sons.
# NOT RUN {
data(finpines)
nncorr(finpines)
# heights of neighbouring trees are slightly negatively correlated
data(amacrine)
nncorr(amacrine)
# neighbouring cells are usually of different type
# }
Run the code above in your browser using DataLab