relrisk.ppm {spatstat.model} | R Documentation |
Parametric Estimate of Spatially-Varying Relative Risk
Description
Given a point process model fitted to a multitype point pattern, this function computes the fitted spatially-varying probability of each type of point, or the ratios of such probabilities, according to the fitted model. Optionally the standard errors of the estimates are also computed.
Usage
## S3 method for class 'ppm'
relrisk(X, ...,
at = c("pixels", "points"),
relative = FALSE, se = FALSE,
casecontrol = TRUE, control = 1, case,
ngrid = NULL, window = NULL)
Arguments
X |
A fitted point process model (object of class |
... |
Ignored. |
at |
String specifying whether to compute the probability values
at a grid of pixel locations ( |
relative |
Logical.
If |
se |
Logical value indicating whether to compute standard errors as well. |
casecontrol |
Logical. Whether to treat a bivariate point pattern as consisting of cases and controls, and return only the probability or relative risk of a case. Ignored if there are more than 2 types of points. See Details. |
control |
Integer, or character string, identifying which mark value corresponds to a control. |
case |
Integer, or character string, identifying which mark value
corresponds to a case (rather than a control)
in a bivariate point pattern.
This is an alternative to the argument |
ngrid |
Optional. Dimensions of a rectangular grid of locations
inside |
window |
Optional. A window (object of class |
Details
The command relrisk
is generic and can be used to
estimate relative risk in different ways.
This function relrisk.ppm
is the method for fitted point
process models (class "ppm"
). It computes parametric
estimates of relative risk, using the fitted model.
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 by default this command computes
the spatially-varying probability of a case,
i.e. the probability
that a point at spatial location
will be a case. If
relative=TRUE
, it computes the
spatially-varying relative risk of a case relative to a
control, .
If X
is a multitype point pattern with types,
or if
X
is a bivariate point pattern
and casecontrol=FALSE
,
then by default this command computes, for each type ,
a nonparametric estimate of
the spatially-varying probability of an event of type
.
This is the probability
that a point at spatial location
will belong to type
.
If
relative=TRUE
, the command computes the
relative risk of an event of type
relative to a control,
,
where events of type
are treated as controls.
The argument
control
determines which type
is treated as a control.
If at = "pixels"
the calculation is performed for
every spatial location on a fine pixel grid, and the result
is a pixel image representing the function
or a list of pixel images representing the functions
or
for
.
An infinite value of relative risk (arising because the
probability of a control is zero) will be returned as
NA
.
If at = "points"
the calculation is performed
only at the data points . By default
the result is a vector of values
giving the estimated probability of a case
at each data point, or a matrix of values
giving the estimated probability of
each possible type
at each data point.
If
relative=TRUE
then the relative risks
or
are
returned.
An infinite value of relative risk (arising because the
probability of a control is zero) will be returned as
Inf
.
Probabilities and risks are computed from the fitted intensity of the model,
using predict.ppm
.
If se=TRUE
then standard errors will also be computed,
based on asymptotic theory, using vcov.ppm
.
Value
If se=FALSE
(the default), the format is described below.
If se=TRUE
, the result is a list of two entries,
estimate
and SE
, each having the format described below.
If X
consists of only two types of points,
and if casecontrol=TRUE
,
the result is a pixel image (if at="pixels"
)
or a vector (if at="points"
).
The pixel values or vector values
are the probabilities of a case if relative=FALSE
,
or the relative risk of a case (probability of a case divided by the
probability of a control) if relative=TRUE
.
If X
consists of more than two types of points,
or if casecontrol=FALSE
, 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"solist"
so that it can be printed and plotted.-
(if
at="points"
) a matrix of probabilities, with rows corresponding to data points, and columns corresponding to types
.
The pixel values or matrix entries
are the probabilities of each type of point if relative=FALSE
,
or the relative risk of each type (probability of each type divided by the
probability of a control) if relative=TRUE
.
If relative=FALSE
, the resulting values always lie between 0
and 1. If relative=TRUE
, the results are either non-negative
numbers, or the values Inf
or NA
.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.
See Also
There is another method relrisk.ppp
for point pattern datasets
which computes nonparametric estimates of relative risk
by kernel smoothing.
See also
relrisk
,
relrisk.ppp
,
ppm
Examples
fit <- ppm(chorley ~ marks * (x+y))
rr <- relrisk(fit, relative=TRUE, control="lung", se=TRUE)
plot(rr$estimate)
plot(rr$SE)
rrX <- relrisk(fit, at="points", relative=TRUE, control="lung")