nncorr
),
the nearest-neighbour mark index (nnmean
),
and the nearest-neighbour variogram index (nnvario
).nncorr(X,
f = function(m1, m2) { m1 * m2 },
...,
use = "all.obs", method = c("pearson", "kendall", "spearman"))
nnmean(X)
nnvario(X)
"ppp"
.f
.cor
. 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.
[object Object],[object Object],[object Object]
In the default case where f
is not given,
nncorr(X)
computes the unnormalised and normalised
versions of the nearest-neighbour product index
$E[M \, M^\ast]$,
and (if the marks are real numbers) the classical correlation
between $M$ and $M^\ast$.
The wrapper functions nnmean
and nnvario
computes the correlation indices for two special choices of the
function $f(m_1,m_2)$.
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 argument f
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 X$window
)
may have arbitrary shape.
Biases due to edge effects are
treated using the
data(finpines)
nncorr(finpines)
# heights of neighbouring trees are slightly negatively correlated
data(amacrine)
nncorr(amacrine, function(m1, m2) { m1 == m2})
# neighbouring cells are usually of different type
Run the code above in your browser using DataLab