Prediction from a Fitted Point Process Model
Given a fitted point process model obtained by
evaluate the spatial trend and the conditional intensity of the model
at new locations.
## S3 method for class 'ppm': predict(object, window, ngrid=NULL, locations=NULL, covariates=NULL, type="trend", \dots, check=TRUE, repair=TRUE)
- A fitted point process model, typically obtained from
the model-fitting algorithm
ppm. An object of class
- window delimiting the locations where predictions
should be computed. Defaults to the window of the
original data used to fit the model
- dimensions (either (
ngrid) of a rectangular grid of locations inside
windowwhere predictions should be computed. (Incompatible with
- data giving the $x,y$ coordinates (and marks, if required)
at which predictions should be computed. Either a data frame
or a binary image mask.
- Values of external covariates required by the model. Either a data frame or a list of images. See Details.
- character string.
Indicates which property of the fitted model should be predicted.
"trend"for the spatial trend, and
"lambda"for the conditional intensity.
- Logical value indicating whether to check the internal format
object. If there is any possibility that this object has been restored from a dump file, or has otherwise lost track of the environment where it was originally compu
- Logical value indicating whether to repair the internal format
object, if it is found to be damaged.
This function computes the spatial trend
and the conditional intensity of a fitted spatial point process model.
See Baddeley and Turner (2000) for explanation and examples.
Given a point pattern dataset, we may fit
a point process model to the data using the
returns an object of class
the fitted point process model (see
The parameter estimates in this fitted model can be read off
simply by printing the
The spatial trend and conditional intensity of the
fitted model are evaluated using this function
The default action is to create a rectangular grid of points in the observation window of the data point pattern, and evaluate the spatial trend and conditional intensity at these locations.
Note that by ``spatial trend'' we mean the (exponentiated) first order potential and not the intensity of the process. [For example if we fit the stationary Strauss process with parameters $\beta$ and $\gamma$, then the spatial trend is constant and equal to $\beta$. ] The conditional intensity $\lambda(u, X)$ of the fitted model is evaluated at each required spatial location $u$, with respect to the data point pattern $X$.
If the argument
ngrid is present, then
predictions are performed at an
pixel grid of locations in the window
The result of prediction will be a pixel image or images.
locations is present, then predictions
will be performed at the spatial locations given by
this dataset. The result of prediction will be either a
vector of values or a pixel image or a list of images, depending
on the format of
locations may be either a data frame or list
specifying arbitrary locations,
or a binary image mask (an object of class
"mask") specifying (a subset of) a rectangular
grid of locations.
locations is a data frame or list, then it must contain
locations$y specifying the
$x,y$ coordinates of the prediction locations. Additionally, if
the model is a marked point process, then
locations must also contain
locations$marks specifying the marks of the
prediction locations. These vectors must have equal length.
The result of prediction will be a vector of predicted values,
of the same length.
locations is a binary image mask, then prediction will be
performed at each pixel in this binary image where the pixel value
TRUE (in other words, at each pixel that is inside the
window). If the fitted model is an unmarked point process, then the
result of prediction will be an image. If the fitted model is a
marked point process, then prediction will
be performed for each possible value of the mark at each such
location, and the result of prediction will be a
list of images, one for each mark value.
locations is given, then
ngrid is assumed. It defaults to 50.
covariates gives the values of any spatial covariates
at the prediction locations.
If the trend formula in the fitted model
involves spatial covariates (other than
the Cartesian coordinates
covariates is required.
The format and use of
covariates are analogous to those of the
argument of the same name in
It is either a data frame or a list of images.
covariates is a list of images, then
the names of the entries should correspond to
the names of covariates in the model formula
Each entry in the list must be an image object (of class
The software will look up
the pixel values of each image at the quadrature points.
covariates is a data frame, then the
ith row of
is assumed to contain covariate data for the
locations is a data frame,
this just means that each row of
covariates contains the
covariate data for the location specified in the corresponding row of
locations is a binary image
mask, the row
covariates[i,] must correspond to the location
x = as.vector(raster.x(locations))
y = as.vector(raster.y(locations)).
Note that if you only want to use prediction in order to
generate a plot of the predicted values,
it may be easier to use
plot.ppm which calls
this function and plots the results.
locationsis given and is a data frame: a vector of predicted values for the spatial locations (and marks, if required) given in
ngridis given, or if
locationsis given and is a binary image mask: If
objectis an unmarked point process, the result is a pixel image object (of class
im.object) containing the predictions. If
objectis a multitype point process, the result is a list of pixel images, containing the predictions for each type at the same grid of locations.
The ``predicted values'' are either values of the spatial trend (if
type="trend") or values of the conditional intensity (if
The current implementation invokes
so that prediction is wrong if the trend formula in
object involves terms in
This is a weakness of
Error messages may be very opaque,
as they tend to come from deep in the workings of
If you are passing the
and the function crashes,
it is advisable to start by checking that all the conditions
listed above are satisfied.
Baddeley, A. and Turner, R. Practical maximum pseudolikelihood for spatial point patterns. Australian and New Zealand Journal of Statistics 42 (2000) 283--322. Berman, M. and Turner, T.R. Approximating point process likelihoods with GLIM. Applied Statistics 41 (1992) 31--38.
data(cells) m <- ppm(cells, ~ polynom(x,y,2), Strauss(0.05), rbord=0.05) trend <- predict(m, type="trend") image(trend) points(cells) cif <- predict(m, type="cif") persp(cif)