Model Compensator of Nearest Neighbour Function
Given a point process model fitted to a point pattern dataset, this function computes the compensator of the nearest neighbour distance distribution function $G$ based on the fitted model (as well as the usual nonparametric estimates of $G$ based on the data alone). Comparison between the nonparametric and model-compensated $G$ functions serves as a diagnostic for the model.
Gcom(object, r = NULL, breaks = NULL, ..., correction = c("border", "Hanisch"), conditional = !is.poisson(object), restrict=FALSE, model=NULL, trend = ~1, interaction = Poisson(), rbord = reach(interaction), ppmcorrection="border", truecoef = NULL, hi.res = NULL)
Object to be analysed.
Either a fitted point process model (object of class
"ppm") or a point pattern (object of class
"ppp") or quadrature scheme (object of class
- Optional. Vector of values of the argument $r$ at which the function $G(r)$ should be computed. This argument is usually not specified. There is a sensible default.
- This argument is for internal use only.
Edge correction(s) to be employed in calculating the compensator.
correction="all"selects all options.
- Optional. Logical value indicating whether to compute the estimates for the conditional case. See Details.
Logical value indicating whether to compute
the restriction estimator (
restrict=TRUE) or the reweighting estimator (
restrict=FALSE, the default). Applies only if
conditional=TRUE. See Details.
Optional. A fitted point process model (object of
"ppm") to be re-fitted to the data using
objectis a point pattern. Overrides the arguments
Optional. Arguments passed to
ppmto fit a point process model to the data, if
objectis a point pattern. See
Extra arguments passed to
Optional. Numeric vector. If present, this will be treated as
if it were the true coefficient vector of the point process model,
in calculating the diagnostic. Incompatible with
Optional. List of parameters passed to
quadscheme. If this argument is present, the model will be re-fitted at high resolution as specified by these parameters. The coefficients of the resulting fitted model will be taken as the true coefficients. Then the diagnostic will be computed for the default quadrature scheme, but using the high resolution coefficients.
This command provides a diagnostic for the goodness-of-fit of a point process model fitted to a point pattern dataset. It computes different estimates of the nearest neighbour distance distribution function $G$ of the dataset, which should be approximately equal if the model is a good fit to the data.
The first argument,
object, is usually a fitted point process model
(object of class
"ppm"), obtained from the
object can also be a point pattern
(object of class
In that case, a point process
model will be fitted to it,
ppm using the arguments
trend (for the first order trend),
interaction (for the interpoint interaction)
rbord (for the erosion distance in the border correction
for the pseudolikelihood). See
ppm for details
of these arguments.
The algorithm first extracts the original point pattern dataset
(to which the model was fitted) and computes the
standard nonparametric estimates of the $G$ function.
It then also computes the model-compensated
$G$ function. The different functions are returned
as columns in a data frame (of class
The interpretation of the columns is as follows
(ignoring edge corrections):
If the fitted model is a Poisson point process, then the formulae above are exactly what is computed. If the fitted model is not Poisson, the formulae above are modified slightly to handle edge effects.
The modification is determined by the arguments
The value of
conditional defaults to
FALSE for Poisson models
TRUE for non-Poisson models.
conditional=FALSE then the formulae above are not modified.
conditional=TRUE, then the algorithm calculates
the restriction estimator if
and calculates the reweighting estimator if
See Appendix E of Baddeley, Rubak
and Moller (2011).
Thus, by default, the reweighting estimator is computed
for non-Poisson models.
The border-corrected and Hanisch-corrected estimates of $G(r)$ are approximately unbiased estimates of the $G$-function, assuming the point process is stationary. The model-compensated functions are unbiased estimates of the mean value of the corresponding nonparametric estimate, assuming the model is true. Thus, if the model is a good fit, the mean value of the difference between the nonparametric and model-compensated estimates is approximately zero.
To compute the difference between the nonparametric and model-compensated
A function value table (object of class
"fv"), essentially a data frame of function values. There is a plot method for this class. See
Baddeley, A., Rubak, E. and Moller, J. (2011) Score, pseudo-score and residual diagnostics for spatial point process models. Statistical Science 26, 613--646.
data(cells) fit0 <- ppm(cells, ~1) # uniform Poisson G0 <- Gcom(fit0) G0 plot(G0) # uniform Poisson is clearly not correct # Hanisch estimates only plot(Gcom(fit0), cbind(han, hcom) ~ r) fit1 <- ppm(cells, ~1, Strauss(0.08)) plot(Gcom(fit1), cbind(han, hcom) ~ r) # Try adjusting interaction distance fit2 <- update(fit1, Strauss(0.10)) plot(Gcom(fit2), cbind(han, hcom) ~ r) G3 <- Gcom(cells, interaction=Strauss(0.12)) plot(G3, cbind(han, hcom) ~ r)