nncorr | R Documentation |
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, na.action="warn")
nnmean(X, k=1, na.action="warn")
nnvario(X, k=1, na.action="warn")
X |
The observed point pattern.
An object of class |
f |
Function |
k |
Integer. The |
... |
Extra arguments passed to |
use , method |
Arguments passed to the standard correlation function |
denominator |
Internal use only. |
na.action |
Character string (passed to |
The nearest neighbour correlation index \bar n_f
of a marked point process X
is a number measuring the dependence between the mark of a typical point
and the mark of its nearest neighbour.
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
\bar n_f = E[f(M, M^\ast)]
where E[]
denotes mean value,
M
is the mark attached to a
typical point of the point process, and M^\ast
is the mark
attached to its nearest neighbour (i.e. the nearest other point of the
point process).
Here f
is any function
f(m_1,m_2)
with two arguments which are possible marks of the pattern,
and which returns a nonnegative real value.
Common choices of f
are:
for continuous real-valued marks,
f(m_1,m_2) = m_1 m_2
for discrete marks (multitype point patterns),
f(m_1,m_2) = 1(m_1 = m_2)
and for marks taking values in [0,2\pi)
,
f(m_1,m_2) = \sin(m_1 - m_2)
For example, in the second case, the unnormalised nearest neighbour
correlation \bar n_f
equals the proportion of
points in the pattern which have the same mark as their nearest
neighbour.
Note that \bar n_f
is not a “correlation”
in the usual statistical sense. It can take values greater than 1.
We can define a normalised nearest neighbour correlation by
\bar m_f = \frac{E[f(M,M^\ast)]}{E[f(M,M')]}
where again M
is the
mark attached to a typical point, M^\ast
is the mark
attached to its nearest neighbour, and M'
is an independent
copy of M
with the same distribution.
This normalisation is also not a “correlation”
in the usual statistical sense, but is normalised so that
the value 1 suggests “lack of correlation”:
if the marks attached to the points of X
are independent
and identically distributed, then
\bar m_f = 1
.
The interpretation of values larger or smaller than 1 depends
on the choice of function f
.
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 M
and M^\ast
.
The classical correlation has a value between -1
and 1
.
Values close to -1
or 1
indicate strong dependence between
the marks.
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
E[M \, M^\ast]
,
and the classical correlation
between M
and M^\ast
.
If the marks of X
are factor valued,
the unnormalised and normalised
versions of the nearest-neighbour equality index
P[M = M^\ast]
.
The wrapper functions nnmean
and nnvario
compute the correlation indices for two special choices of the
function f(m_1,m_2)
. They are defined only when the
marks are numeric.
nnmean
computes the correlation indices for
f(m_1,m_2) = m_1
. The unnormalised index
is simply the mean value of the mark of the neighbour of a typical point,
E[M^\ast]
, while the normalised index is
E[M^\ast]/E[M]
, the ratio of the mean mark of the
neighbour of a typical point to the mean mark of a typical point.
nnvario
computes the correlation indices for
f(m_1,m_2) = (1/2) (m_1-m_2)^2
.
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.
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.
and \rolf
Stoyan, D. and Stoyan, H. (1994) Fractals, random shapes and point fields: methods of geometrical statistics. John Wiley and Sons.
nnmean(finpines)
nnvario(finpines)
nncorr(finpines)
# heights of neighbouring trees are slightly negatively correlated
nncorr(amacrine)
# neighbouring cells are usually of different type
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.