Residuals for Fitted Point Process Model
Given a point process model fitted to a point pattern, compute residuals.
## S3 method for class 'ppm': residuals(object, type="raw", \dots, check=TRUE, drop=FALSE, fittedvalues=fitted.ppm(object, check=check, drop=drop), coefs=NULL, quad=NULL)
- The fitted point process model (an object of class
"ppm") for which residuals should be calculated.
- String indicating the type of residuals to be calculated.
Current options are
"score". A partial match is adequate.
- Logical value indicating whether to check the internal format
object. If there is any possibility that this object has been restored from a dump file, or has otherwise lost track of the environment where it was originally compu
- Logical value determining whether to delete quadrature points
that were not used to fit the model. See
- Vector of fitted values for the conditional intensity at the quadrature points, from which the residuals will be computed. For expert use only.
- Optional. Numeric vector of coefficients for the model,
coef(object). See the section on Modified Residuals below.
- Optional. Data specifying how to re-fit the model.
A list of arguments passed to
quadscheme. See the section on Modified Residuals below.
This function computes several kinds of residuals for the fit of
a point process model to a spatial point pattern dataset
(Baddeley et al, 2005).
plot.msr to plot the residuals directly,
to produce diagnostic plots based on these residuals.
object must be a fitted point process model
(object of class
"ppm"). Such objects are produced by the maximum
pseudolikelihood fitting algorithm
This fitted model object contains complete
information about the original data pattern.
Residuals are attached both to the data points and to some
other points in the window of observation (namely, to the dummy
points of the quadrature scheme used to fit the model).
If the fitted model is correct, then the sum of the
residuals over all (data and dummy) points in a spatial region $B$
has mean zero. For further explanation, see Baddeley et al (2005).
The type of residual
is chosen by the argument
type. Current options are
- An object of class
"msr"representing a signed measure or vector-valued measure (see
msr). This object can be plotted.
Sometimes we want to modify the calculation of residuals by using
different values for the model parameters. This capability is
provided by the arguments
coefs is given, then the residuals will be computed
by taking the model parameters to be
This should be a numeric vector
of the same length as the vector of fitted model parameters
coefs is missing and
quad is given,
then the model parameters will
be determined by re-fitting the model using a new
quadrature scheme specified by
Residuals will be computed for the
object using these new parameter values.
quad should normally be
a list of arguments in
name=value format that will be
quadscheme (together with
the original data points) to determine the new quadrature scheme.
It may also be a quadrature scheme (object of class
"quad" to which the model should be fitted, or a
point pattern (object of class
"ppp" specifying the
dummy points in a new quadrature scheme.
Baddeley, A., Turner, R., Moller, J. and Hazelton, M. (2005) Residual analysis for spatial point processes. Journal of the Royal Statistical Society, Series B 67, 617--666.
Baddeley, A., Moller, J. and Pakes, A.G. (2008) Properties of residuals for spatial point processes. Annals of the Institute of Statistical Mathematics 60, 627--649.
data(cells) fit <- ppm(cells, ~x, Strauss(r=0.15)) # Pearson residuals rp <- residuals(fit, type="pe") rp # simulated data X <- rStrauss(100,0.7,0.05) # fit Strauss model fit <- ppm(X, ~1, Strauss(0.05)) res.fit <- residuals(fit) # true model parameters truecoef <- c(log(100), log(0.7)) res.true <- residuals(fit, coefs=truecoef)