
Last chance! 50% off unlimited learning
Sale ends in
Estimate the marked correlation function of a marked point pattern.
markcorr(X, f = function(m1, m2) { m1 * m2}, r=NULL,
correction=c("isotropic", "Ripley", "translate"),
method="density", …, weights=NULL,
f1=NULL, normalise=TRUE, fargs=NULL)
The observed point pattern.
An object of class "ppp"
or something acceptable to
as.ppp
.
Optional. Test function
Optional. Numeric vector. The values of the argument
A character vector containing any selection of the
options "isotropic"
, "Ripley"
, "translate"
,
"translation"
, "none"
or "best"
.
It specifies the edge correction(s) to be applied.
Alternatively correction="all"
selects all options.
A character vector indicating the user's choice of
density estimation technique to be used. Options are
"density"
,
"loess"
,
"sm"
and "smrep"
.
Optional numeric vector of weights for each data point in X
.
An alternative to f
. If this argument is given,
then
If normalise=FALSE
,
compute only the numerator of the expression for the
mark correlation.
Optional. A list of extra arguments to be passed to the function
f
or f1
.
A function value table (object of class "fv"
)
or a list of function value tables, one for each column of marks.
An object of class "fv"
(see fv.object
)
is essentially a data frame containing numeric columns
the values of the argument
the theoretical value of
By default, this command calculates an estimate of
Stoyan's mark correlation
Alternatively if the argument f
or f1
is given, then it
calculates Stoyan's generalised mark correlation
Theoretical definitions are as follows (see Stoyan and Stoyan (1994, p. 262)):
For a point process
For a multitype point process
The generalised mark correlation function
The test function
Note that X
are independent
and identically distributed, then
The argument X
must be a point pattern (object of class
"ppp"
) or any data that are acceptable to as.ppp
.
It must be a marked point pattern.
The argument f
determines the function to be applied to
pairs of marks. It has a sensible default, which depends on the
kind of marks in X
. If the marks
are numeric values, then f <- function(m1, m2) { m1 * m2}
computes the product of two marks.
If the marks are a factor (i.e. if X
is a multitype point
pattern) then f <- function(m1, m2) { m1 == m2}
yields
the value 1 when the two marks are equal, and 0 when they are unequal.
These are the conventional definitions for numerical
marks and multitype points respectively.
The argument f
may be specified by the user.
It must be an R 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 may also take additional arguments, passed through fargs
).
It must return a vector of numeric
values of the same length as m1
and m2
.
The values must be non-negative, and NA
values are not permitted.
Alternatively the user may specify the argument f1
instead of f
. This indicates that the test function f1
.
The argument f1
should be an R function with at least one
argument.
(It may also take additional arguments, passed through fargs
).
The argument r
is the vector of values for the
distance
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 in the same manner as in Kest
.
The edge corrections implemented here are
Ripley's isotropic correction (see Ripley, 1988; Ohser, 1983). This is implemented only for rectangular and polygonal windows (not for binary masks).
Translation correction (Ohser, 1983). Implemented for all window geometries, but slow for complex windows.
Note that the estimator assumes the process is stationary (spatially homogeneous).
The numerator and denominator of the mark correlation function (in the expression above) are estimated using density estimation techniques. The user can choose between
"density"
which uses the standard kernel
density estimation routine density
, and
works only for evenly-spaced r
values;
"loess"
which uses the function loess
in the
package modreg;
"sm"
which uses the function sm.density
in the
package sm and is extremely slow;
"smrep"
which uses the function sm.density
in the
package sm and is relatively fast, but may require manual
control of the smoothing parameter hmult
.
If normalise=FALSE
then the algorithm will compute
only the numerator
Stoyan, D. and Stoyan, H. (1994) Fractals, random shapes and point fields: methods of geometrical statistics. John Wiley and Sons.
Mark variogram markvario
for numeric marks.
Mark connection function markconnect
and
multitype K-functions Kcross
, Kdot
for factor-valued marks.
Mark cross-correlation function markcrosscorr
for point patterns with several columns of marks.
Kmark
to estimate a cumulative function
related to the mark correlation function.
# NOT RUN {
# CONTINUOUS-VALUED MARKS:
# (1) Spruces
# marks represent tree diameter
# mark correlation function
ms <- markcorr(spruces)
plot(ms)
# (2) simulated data with independent marks
X <- rpoispp(100)
X <- X %mark% runif(npoints(X))
# }
# NOT RUN {
Xc <- markcorr(X)
plot(Xc)
# }
# NOT RUN {
# MULTITYPE DATA:
# Hughes' amacrine data
# Cells marked as 'on'/'off'
# (3) Kernel density estimate with Epanecnikov kernel
# (as proposed by Stoyan & Stoyan)
M <- markcorr(amacrine, function(m1,m2) {m1==m2},
correction="translate", method="density",
kernel="epanechnikov")
plot(M)
# Note: kernel="epanechnikov" comes from help(density)
# (4) Same again with explicit control over bandwidth
# }
# NOT RUN {
M <- markcorr(amacrine,
correction="translate", method="density",
kernel="epanechnikov", bw=0.02)
# see help(density) for correct interpretation of 'bw'
# }
# NOT RUN {
# }
# NOT RUN {
# weighted mark correlation
Y <- subset(betacells, select=type)
a <- marks(betacells)$area
v <- markcorr(Y, weights=a)
# }
Run the code above in your browser using DataLab