This function fits a point process model
to an observed point pattern.
The model may include
spatial trend, interpoint interaction, and dependence on covariates.
The model fitted by ppm
is either a Poisson point process (in which different points
do not interact with each other) or a Gibbs point process (in which
different points typically inhibit each other).
For clustered point process models, use kppm
.
The function ppm
is generic, with methods for
the classes formula
, ppp
and quad
.
This page describes the method for a formula
.
The first argument is a formula
in the R language
describing the spatial trend model to be fitted. It has the general form
pattern ~ trend
where the left hand side pattern
is usually
the name of a spatial point pattern (object of class "ppp"
)
to which the model should be fitted, or an expression which evaluates
to a point pattern;
and the right hand side trend
is an expression specifying the
spatial trend of the model.
Systematic effects (spatial trend and/or dependence on
spatial covariates) are specified by the
trend
expression on the right hand side of the formula.
The trend may involve
the Cartesian coordinates x
, y
,
the marks marks
,
the names of entries in the argument data
(if supplied),
or the names of objects that exist in the R session.
The trend formula specifies the logarithm of the
intensity of a Poisson process, or in general, the logarithm of
the first order potential of the Gibbs process.
The formula should not use any names beginning with .mpl
as these are reserved for internal use.
If the formula is pattern~1
, then
the model to be fitted is stationary (or at least, its first order
potential is constant).
The symbol .
in the trend expression stands for
all the covariates supplied in the argument data
.
For example the formula pattern ~ .
indicates an additive
model with a main effect for each covariate in data
.
Stochastic interactions between random points of the point process
are defined by the argument interaction
. This is an object of
class "interact"
which is initialised in a very similar way to the
usage of family objects in glm
and gam
.
The interaction models currently available are:
AreaInter
, BadGey
, Concom
, DiggleGatesStibbard
, DiggleGratton
, Fiksel
, Geyer
, Hardcore
, HierHard
, HierStrauss
, HierStraussHard
, Hybrid
, LennardJones
, MultiHard
, MultiStrauss
, MultiStraussHard
, OrdThresh
, Ord
, Pairwise
, PairPiece
, Penttinen
, Poisson
, Saturated
, SatPiece
, Softcore
, Strauss
, StraussHard
and Triplets
.
See the examples below.
Note that it is possible to combine several interactions
using Hybrid
.
If interaction
is missing or NULL
,
then the model to be fitted
has no interpoint interactions, that is, it is a Poisson process
(stationary or nonstationary according to trend
). In this case
the methods of maximum pseudolikelihood and maximum logistic likelihood
coincide with maximum likelihood.
The fitted point process model returned by this function can be printed
(by the print method print.ppm
)
to inspect the fitted parameter values.
If a nonparametric spatial trend was fitted, this can be extracted using
the predict method predict.ppm
.
To fit a model involving spatial covariates
other than the Cartesian coordinates \(x\) and \(y\),
the values of the covariates should either be supplied in the
argument data
, or should be stored in objects that exist
in the R session.
Note that it is not sufficient to have observed
the covariate only at the points of the data point pattern;
the covariate must also have been observed at other
locations in the window.
If it is given, the argument data
is typically
a list, with names corresponding to variables in the trend
formula.
Each entry in the list is either
- a pixel image,
giving the values of a spatial covariate at
a fine grid of locations. It should be an object of
class "im"
, see im.object
.
- a function,
which can be evaluated
at any location (x,y)
to obtain the value of the spatial
covariate. It should be a function(x, y)
or function(x, y, ...)
in the R language.
The first two arguments of the function should be the
Cartesian coordinates \(x\) and \(y\). The function may have
additional arguments; if the function does not have default
values for these additional arguments, then the user must
supply values for them, in covfunargs
.
See the Examples.
- a window,
interpreted as a logical variable
which is TRUE
inside the window and FALSE
outside
it. This should be an object of class "owin"
.
- a tessellation,
interpreted as a factor covariate.
For each spatial location, the factor value indicates
which tile of the tessellation it belongs to.
This should be an object of class "tess"
.
- a single number,
indicating a covariate that is
constant in this dataset.
The software will look up
the values of each covariate at the required locations
(quadrature points).
Note that, for covariate functions, only the name of the
function appears in the trend formula. A covariate function is
treated as if it were a single variable. The function arguments do not
appear in the trend formula. See the Examples.
If data
is a list,
the list entries should have names corresponding to
(some of) the names of covariates in the model formula trend
.
The variable names x
, y
and marks
are reserved for the Cartesian
coordinates and the mark values,
and these should not be used for variables in data
.
Alternatively, data
may be a data frame
giving the values of the covariates at specified locations.
Then pattern
should be a quadrature scheme (object of class
"quad"
) giving the corresponding locations.
See ppm.quad
for details.