Estimates the inhomogeneous multitype pair correlation function for a multitype point pattern.
pcfmulti.inhom(X, I, J, lambdaI = NULL, lambdaJ = NULL, ...,
lambdaX=NULL,
r = NULL, breaks = NULL, rmax = NULL,
adaptive = FALSE,
kernel = "epanechnikov", bw = NULL, h = NULL, bw.args = list(),
stoyan = 0.15, adjust.bw = 1,
correction = c("translate", "Ripley"),
divisor = c("a", "r", "d", "t"),
zerocor = c("convolution", "reflection",
"bdrykern", "JonesFoster", "weighted",
"none", "good", "best"),
nsmall = 300,
gref = NULL, tau = 0,
sigma = NULL, adjust.sigma = 1, varcov = NULL,
update = TRUE, leaveoneout = TRUE,
Iname = "points satisfying condition I",
Jname = "points satisfying condition J",
IJexclusive = FALSE, Ilevels=NULL, Jlevels=NULL,
close = NULL)An object of class "fv".
The observed point pattern, from which an estimate of the inhomogeneous cross-type pair correlation function \(g_{ij}(r)\) will be computed. It must be a multitype point pattern (a marked point pattern whose marks are a factor).
Subset index specifying the points of X
from which distances are measured.
Subset index specifying the points in X
to which distances are measured.
Optional.
Values of the estimated intensity function of the points
belonging to subset I.
(Ignored if lambdaX is given.)
Either a numeric vector giving the intensity values
at the data points of subset I,
a pixel image (object of class "im") giving the
intensity values of points of subset I at all locations,
a function(x,y) which
can be evaluated to give the intensity value of points of subset I
at any location, or a fitted point process model
(class "ppm", "kppm", "dppm" or "slrm")
which could be used to predict the
intensity values of points of subset J at all locations.
If lambdaI is an unmarked point process model, it is assumed
to have been fitted to X[I]; if it is a multitype point
process model, it is assumed to have been fitted to X,
and the argument Ilevels is required.
Optional.
Values of the estimated intensity function of the points
belonging to subset J.
A numeric vector, pixel image, function(x,y),
or fitted point process model.
Ignored if lambdaX is given.
Ignored.
Optional.
Alternative to lambdaI and lambdaJ.
Data which can be used to calculate the intensity functions
of both the subsets I and J.
A list of pixel images (one image for each possible type of point),
a function(x,y,mark) giving the intensity at each location
for each possible type of point, a numeric matrix with one row for
each point in X and one column for each possible type of
point, or a fitted multitype point process model (class
"ppm"). The arguments Ilevels and Jlevels are
required in this case.
Vector of values for the argument \(r\) at which \(g(r)\) should be evaluated. There is a sensible default.
Internal use only.
Optional. Maximum desired value of the argument \(r\). A single numeric value. There is a sensible default.
Logical value specifying whether to use adaptive kernel smoothing
(adaptive=TRUE) or fixed-bandwidth kernel smoothing
(adaptive=FALSE, the default).
Choice of smoothing kernel,
passed to density.default.
Bandwidth for smoothing kernel. Either a single numeric value giving the standard deviation of the kernel, or a character string specifying a bandwidth selection rule, or a function that computes the selected bandwidth. See Details.
Kernel halfwidth \(h\) (incompatible with argument bw).
A numerical value.
The parameter h is defined as the
half-width of the support of the kernel, except for the Gaussian
kernel where h is the standard deviation.
Optional. List of additional arguments to be passed to bw
when bw is a function. Alternatively, bw may be a
function that should be applied to X to produce a list of
additional arguments.
Coefficient for default bandwidth rule.
Numerical adjustment factor for the bandwidth.
The bandwidth actually used is bw * adjust.bw.
This makes it easy to specify choices like
‘half the selected bandwidth’.
String (partially matched) specifying the choice or choices
of spatial edge correction. Options include "translate" for
the translation correction, "isotropic" or "Ripley"
for Ripley's isotropic correction, and "none" for no edge correction.
String specifying the choice of estimator.
See pcf.ppp.
String (partially matched) specifying a correction for the boundary effect
bias at \(r=0\). Possible values are
"none", "weighted", "convolution",
"reflection", "bdrykern" and "JonesFoster".
See pcf.ppp.
Optional. Integer. The maximum number of data points
for which the default value of zerocor will be
"JonesFoster".
Optional. A pair correlation function that will be used as the
reference for the transformation to uniformity, when
divisor="t". Either a function in the R language
giving the pair correlation function, or a fitted model
(object of class "kppm", "dppm", "ppm"
or "slrm") or a theoretical point process model
(object of class "zclustermodel" or "detpointprocfamily")
for which the pair correlation function
can be computed.
Optional shrinkage coefficient. A single numeric value.
Optional arguments passed to density.ppp
to control the smoothing bandwidth, when lambda is
estimated by kernel smoothing.
Numeric value. sigma will be multiplied by this value.
Logical value indicating what to do when
lambdaI, lambdaJ or lambdaX
is a fitted point process model
(class "ppm", "kppm" or "dppm").
If update=TRUE (the default),
the model will first be updated (refitted to the data)
before the fitted intensity lambdaI or lambdaJ
at the data points is computed.
If update=FALSE, the fitted intensity of the
model will be computed without re-fitting the model.
Logical value (passed to density.ppp or
fitted.ppm) specifying whether to use a
leave-one-out rule when calculating the intensity.
Optional. Character strings describing the members of
the subsets I and J.
Logical value indicating whether the subsets I and J
are guaranteed to be mutually exclusive.
Character vector containing the types of points
(levels of marks(X)) which
comprise the subset I.
Required when lambdaX is given
or when lambdaI is a multitype point process model.
Character vector containing the types of points
(levels of marks(X)) which
comprise the subset J.
Required when lambdaX is given
or when lambdaJ is a multitype point process model.
Advanced use only.
Precomputed data obtained from crosspairs.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net, Ege Rubak rubak@math.aau.dk, Tilman Davies Tilman.Davies@otago.ac.nz and Martin Hazelton Martin.Hazelton@otago.ac.nz.
This is a generalisation of pcfcross.inhom
to arbitrary collections of points.
The algorithm measures the distance from each data point
in subset I to each data point in subset J,
excluding identical pairs of points. The distances are
weighted by the reciprocal intensity (as described below), then
kernel-smoothed and renormalised to form a pair correlation
function.
The contribution from each pair of data points \(u,v\) is weighted by
\(1/(\lambda_I(u) \lambda_J(v))\)
where \(\lambda_I(u)\) is the estimated intensity
of points belonging to subset I at location \(u\),
and similarly \(\lambda_J(u)\) is the estimated intensity
of points belonging to subset J at location \(v\).
The estimated intensities \(\lambda_I(u)\) and \(\lambda_J(u)\) are determined as follows.
If lambdaX is given, then it should
provide data giving the intensities of both subsets I and
J. It may be
A list of pixel images, one for each possible type of point
A function(x,y,mark) which can be evaluated to
give the intensity of each type of point at any location
A matrix with one row for each data point in X
and one column for each possible type of point, giving the estimated
intensity of each type of point at each data location
A fitted point process model (class "lppm" or "ppm")
that was fitted to a multitype point pattern. If
update=TRUE, this model will be re-fitted to the data
pattern X. Then the fitted intensities for subsets I and
J will be computed (using the information Ilevels
and Jlevels).
Otherwise if lambdaI is given, it may be
A pixel image
A function(x,y)
A numeric vector with one entry for each data point in X[I]
A fitted point process model (class "lppm" or "ppm")
that was fitted to a multitype point pattern. If
update=TRUE, this model will be re-fitted to the data
pattern X. Then the intensity of this model for
the subset I will be computed (using the information
Ilevels).
A fitted point process model
(class "lppm", "ppm", "kppm", "dppm" or "slrm")
that was fitted to an unmarked point pattern. If
update=TRUE, this model will be re-fitted to the relevant subset of
the data, unmark(X[I]). Then the intensity of this fitted model
will be computed.
Otherwise if lambda is missing or NULL,
then a kernel estimate of the intensity
\(\lambda_I(u)\)
will be computed by applying density.ppp
to X[I] using the arguments
sigma, adjust.sigma, varcov
and leaveoneout.
Similarly for lambdaJ.
The smoothing algorithm is a multitype version of the
smoothing algorithm in pcf.ppp.
See pcf.ppp for detailed documentation of the arguments
correction, divisor, zerocor,
and other smoothing arguments.
pcfcross.inhom,
pcf.ppp.
adult <- (marks(longleaf) >= 30)
juvenile <- !adult
p <- pcfmulti.inhom(longleaf, adult, juvenile)
Run the code above in your browser using DataLab