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.## S3 method for class 'mppm':
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 "trend"
for the spatial trend
(first-order term) and "cif"
or "lambda"
for the
conditional intensity.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.
mppm
,
fitted.mppm
,
hyperframe
data(waterstriders)
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, Bugs$window))
p2 <- predict(fit, locations=loc)
plot(p2$trend)
Run the code above in your browser using DataLab