Given a model which has been fitted to point pattern data by recursive partitioning, compute the predicted intensity of the model.
# S3 method for rppm
predict(object, …)# S3 method for rppm
fitted(object, …)
Fitted point process model of class "rppm"
produced by the function rppm
.
Optional arguments passed to predict.ppm
to specify the locations where prediction is required.
(Ignored by fitted.rppm
)
The result of fitted.rppm
is a numeric vector.
The result of predict.rppm
is a pixel image, a list of pixel images,
or a numeric vector.
These functions are methods for the generic functions
fitted
and predict
.
They compute the fitted intensity of a point process model.
The argument object
should be a fitted point process model
of class "rppm"
produced by the function rppm
.
The fitted
method computes the fitted intensity at the original data
points, yielding a numeric vector with one entry for each data point.
The predict
method computes the fitted intensity at
any locations. By default, predictions are
calculated at a regular grid of spatial locations, and the result
is a pixel image giving the predicted intensity values at these
locations.
Alternatively, predictions can be performed at other
locations, or a finer grid of locations, or only at certain specified
locations, using additional arguments …
which will be interpreted by predict.ppm
.
Common arguments are ngrid
to increase the grid resolution,
window
to specify the prediction region, and locations
to specify the exact locations of predictions.
See predict.ppm
for details of these arguments.
Predictions are computed by evaluating the explanatory covariates at each desired location, and applying the recursive partitioning rule to each set of covariate values.
# NOT RUN {
fit <- rppm(unmark(gorillas) ~ vegetation, data=gorillas.extra)
plot(predict(fit))
lambdaX <- fitted(fit)
lambdaX[1:5]
# Mondriaan pictures
plot(predict(rppm(redwoodfull ~ x + y)))
points(redwoodfull)
# }
Run the code above in your browser using DataLab