mppm
,
evaluate the spatial trend and/or the conditional intensity of the
model. By default, predictions are evaluated over a grid of
locations, yielding pixel images of the trend and conditional intensity.
Alternatively predictions may be evaluated at specified
locations with specified values of the covariates.
"predict"(object, ..., newdata = NULL, type = c("trend", "cif"), ngrid = 40, locations=NULL, verbose=FALSE)
"mppm"
obtained from mppm
.
newdata=NULL
, predictions are computed for the original
values of the covariates, to which the model was fitted.
Otherwise newdata
should be a hyperframe
(see hyperframe
) containing columns of covariates
as required by the model. If type
includes "cif"
,
then newdata
must also include a column of spatial point
pattern responses, in order to compute the conditional intensity.
"trend"
for the spatial trend
(first-order term) and "cif"
or "lambda"
for the
conditional intensity.
Alternatively type="all"
selects all options.
locations=NULL
). An integer or a pair of integers.
newdata
.
trend
and cif
.If locations=NULL
, the entries of the hyperframe are
pixel images.If locations
is not null, the entries are
marked point patterns constructed by attaching the predicted values
to the locations
point patterns.
If locations=NULL
, then predictions are performed
at an ngrid
by ngrid
grid of locations in the window
for each response point pattern. The result will be a hyperframe
containing a column of images of the trend (if selected)
and a column of images of the conditional intensity (if selected).
The result can be plotted.
If locations
is given, then it should be a list of point
patterns (objects of class "ppp"
). Predictions are performed at these
points. The result is a hyperframe containing a column of
marked point patterns where the locations
each point.
Baddeley, A., Rubak, E. and Turner, R. (2015) Spatial Point Patterns: Methodology and Applications with R. London: Chapman and Hall/CRC Press.
mppm
,
fitted.mppm
,
hyperframe
h <- hyperframe(Bugs=waterstriders)
fit <- mppm(Bugs ~ x, data=h, interaction=Strauss(7))
# prediction on a grid
p <- predict(fit)
plot(p$trend)
# prediction at specified locations
loc <- with(h, runifpoint(20, Window(Bugs)))
p2 <- predict(fit, locations=loc)
plot(p2$trend)
Run the code above in your browser using DataLab