| relrisk {spatstat} | R Documentation |
Given a multitype point pattern, this function estimates the spatially-varying probability of each type of point, using kernel smoothing. The default smoothing bandwidth is selected by cross-validation.
relrisk(X, sigma = NULL, ..., varcov = NULL, at = "pixels",
casecontrol=TRUE, case=2)
X |
A multitype point pattern (object of class |
sigma |
Optional. The numeric value of the smoothing bandwidth
(the standard deviation of isotropic
Gaussian smoothing kernel).
Alternatively |
... |
Arguments passed to |
varcov |
Optional. Variance-covariance matrix of anisotopic Gaussian
smoothing kernel. Incompatible with |
at |
String specifying whether to compute the probability values
at a grid of pixel locations ( |
casecontrol |
Logical. Whether to treat a bivariate point pattern as consisting of cases and controls. See Details. |
case |
Integer, or character string, identifying which mark value corresponds to a case (rather than a control). |
If X is a bivariate point pattern
(a multitype point pattern consisting of two types of points)
then by default,
the points of the first type (the first level of marks(X))
are treated as controls or non-events, and points of the second type
are treated as cases or events. Then this command computes
the spatially-varying risk of an event,
i.e. the probability p(u)
that a point at spatial location u
will be a case.
If X is a multitype point pattern with m > 2 types,
or if X is a bivariate point pattern
and casecontrol=FALSE,
then this command computes, for each type j,
a nonparametric estimate of
the spatially-varying risk of an event of type j.
This is the probability p[j](u)
that a point at spatial location u
will belong to type j.
If at = "pixels" the calculation is performed for
every spatial location u on a fine pixel grid, and the result
is a pixel image representing the function p(u)
or a list of pixel images representing the functions
p[j](u) for j = 1,...,m.
If at = "points" the calculation is performed
only at the data points x[i]. The result is a vector of values
p(x[i]) giving the estimated probability of a case
at each data point, or a matrix of values
p[j](x[i]) giving the estimated probability of
each possible type j at each data point.
Estimation is performed by a simple Nadaraja-Watson type kernel smoother (Diggle, 2003). The smoothing bandwidth can be specified in any of the following ways:
sigma is a single numeric value, giving the standard
deviation of the isotropic Gaussian kernel.
sigma is a numeric vector of length 2, giving the
standard deviations in the x and y directions of
a Gaussian kernel.
varcov is a 2 by 2 matrix giving the
variance-covariance matrix of the Gaussian kernel.
sigma is a function which selects
the bandwidth.
Bandwidth selection will be applied
separately to each type of point.
An example of such a function is bw.diggle.
sigma and varcov
are both missing or null. Then a common
smoothing bandwidth sigma
will be selected by cross-validation using bw.relrisk.
If X consists of only two types of points,
the result is a pixel image (if at="pixels")
or a vector of probabilities (if at="points").
If X consists of more than two types of points,
the result is:
(if at="pixels")
a list of pixel images, with one image for each possible type of point.
The result also belongs to the class "listof" so that it can
be printed and plotted.
(if at="points")
a matrix of probabilities, with rows corresponding to
data points x[i], and columns corresponding
to types j.
Adrian Baddeley Adrian.Baddeley@uwa.edu.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner r.turner@auckland.ac.nz
Diggle, P.J. (2003) Statistical analysis of spatial point patterns, Second edition. Arnold.
bw.relrisk,
density.ppp,
Smooth.ppp,
eval.im
data(urkiola)
p <- relrisk(urkiola, 20)
if(interactive()) {
plot(p, main="proportion of oak")
plot(eval.im(p > 0.3), main="More than 30 percent oak")
plot(split(lansing), main="Lansing Woods")
rr <- relrisk(lansing, 0.05)
plot(rr, main="Lansing Woods relative risk")
wh <- im.apply(rr, which.max)
types <- levels(marks(lansing))
wh <- eval.im(types[wh])
plot(wh, main="Most common species")
}