predict.ppm
Prediction from a Fitted Point Process Model
Given a fitted point process model obtained by mpl
,
evaluate the spatial trend and the conditional intensity of the model
at new locations.
- Keywords
- spatial
Usage
predict.ppm(object, nx = 40, ny = NULL, type="trend")
predict.ppm(object, newdata, type="trend")
Arguments
- object
- A fitted point process model, typically obtained from
the maximum pseudolikelihood algorithm
mpl
. An object of class"ppm"
(seeppm.object
- newdata
- data frame giving the values of any spatial covariates for the locations at which the trend and conditional intensity should be computed.
- nx
- predictions are to be made at
an (
nx
byny
) rectangular grid of positions in the original window of observation. - ny
- see
nx
above;ny
defaults to the same value asnx
- type
- character string.
Indicates which property of the fitted model should be predicted.
Options are
"trend"
for the spatial trend, and"cif"
or"lambda"
for the conditional intensity.
Details
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
maximum pseudolikelihood algorithm mpl
. This
returns an object of class "ppm"
representing
the fitted point process model (see ppm.object
).
The parameter estimates in this fitted model can be read off
simply by printing the ppm
object.
The spatial trend and conditional intensity of the
fitted model are evaluated using this function predict.ppm
.
This is feasible in such generality because the Berman-Turner-Baddeley method
(Berman and Turner, 1992; Baddeley and Turner, 2000)
reduces maximum pseudolikelihood estimation to the fitting
of a GLM or GAM, and because Splus/Rcontains predict
methods for
glm
and gam
objects. The current implementation
invokes predict.glm
.
The default action is to create a rectangular 40 by 40 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$.
The argument newdata
, if given, is a data frame
giving the values of any spatial covariates
at the locations where the trend and conditional intensity should be
computed.
If the trend formula in the fitted model
involves spatial covariates (other than
the Cartesian coordinates x
, y
)
then newdata
is required.
If newdata
is present then it must contain variables
matching all the variable names featuring in the trend formula
and the Cartesian coordinates x
and y
and the mark values marks
.
[This is different from the role of the data
argument in mpl
which must not contain
x
and y
variables.]
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.
Value
- A list with components
x
,y
,z
giving the Cartesian coordinates and the predicted values respectively. Iftype="trend"
then the predicted values inz
are values of the spatial trend. Iftype="cif"
ortype="lambda"
then the entries ofz
are values of the conditional intensity.If the argument
newdata
is given, thenz
is a vector of length equal to the number of rows innewdata
, and gives the predicted values corresponding to the rows innewdata
.If
newdata
is absent, then for unmarked point processes,z
is an (nx
byny
) matrix giving the predicted values at a rectangular grid of locations; for marked point processes,z
is an (nx
byny
bynmarks
) array such thatz[,,m]
gives the predicted values for mark valuem
at a rectangular grid of locations.
synopsis
predict.ppm(object, newdata, nx = 40, ny = NULL, type="trend",...)
Warnings
The current implementation invokes predict.glm
so that prediction is wrong if the trend formula in
object
involves terms in ns()
,
bs()
or poly()
.
This is a weakness of predict.glm
itself!
Error messages may be very opaque,
as they tend to come from deep in the workings of
predict.glm
.
If you are passing the newdata
argument
and the function crashes,
it is advisable to start by checking that all the conditions
listed above are satisfied.
References
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.
See Also
Examples
library(spatstat)
data(cells)
m <- mpl(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)