diagnose.ppm(object, ..., type="raw", which="all", sigma=NULL, rbord=reach(object), cumulative=TRUE, plot.it=TRUE, rv = NULL, compute.sd=is.poisson(object), compute.cts=TRUE, envelope=FALSE, nsim=39, nrank=1, typename, check=TRUE, repair=TRUE, oldstyle=FALSE, splineargs=list(spar=0.5))
"plot"(x, ..., which, plot.neg=c("image", "discrete", "contour", "imagecontour"), plot.smooth=c("imagecontour", "image", "contour", "persp"), plot.sd, spacing=0.1, outer=3, srange=NULL, monochrome=FALSE, main=NULL)
"ppm"
)
for which diagnostics should be produced. This object
is usually obtained from ppm
.
"eem"
for the Stoyan-Grabarnik exponential energy weights,
"raw"
for the raw residuals,
"inverse"
for the inverse-lambda residuals,
and "pearson"
for the Pearson residuals.
A partial match is adequate.
"all"
, "marks"
, "smooth"
,
"x"
, "y"
and "sum"
.
Multiple choices may be given but must be matched exactly.
See Details.
"smooth"
option.
rbord
units away from the edge of the window.
(An infinite value of rbord
will be ignored.)
cumulative=TRUE
) or the
plots of marginal integrals of the smoothed residual field
(cumulative=FALSE
).
plot.it=FALSE
,
the computed diagnostic quantities are returned without plotting them.
"x"
and "y"
plots. The default is TRUE
for Poisson models and
FALSE
for non-Poisson models. See Details.
lurking
in order to plot simulation envelopes for the lurking variable plots.
object
but will instead
be taken directly from rv
.
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 computed, set
check=TRUE
.
object
, if it is found to be damaged.
oldstyle=TRUE
),
or using the correct asymptotic formula (oldstyle=FALSE
).
lurking
to control the smoothing in the lurking variable plot.
diagnose.ppm
. An object of class "diagppm"
.
diagnose.ppm
to density.ppp
)
or the appearance of the plots
(passed from diagnose.ppm
to plot.diagppm
and from
plot.diagppm
to plot.default
).
"diagppm"
which contains
the coordinates needed to reproduce the selected plots.
This object can be plotted using plot.diagppm
and printed using print.diagppm
.
object
is a model that was obtained by
first fitting a model to replicated point pattern data using
mppm
and then using subfits
to extract
a model for one of the individual point patterns, then the
variance calculations are only implemented for the
innovation variance (oldstyle=TRUE
) and this is the default
in such cases.diagnose.ppm
generates several diagnostic plots for a
fitted point process model.
The plots display the residuals from the fitted model
(Baddeley et al, 2005)
or alternatively the `exponential energy marks' (Stoyan and Grabarnik, 1991).
These plots can be used to
assess goodness-of-fit, to identify outliers in the data,
and to reveal departures from the fitted model.
See also the companion function qqplot.ppm
. The argument object
must be a fitted point process model
(object of class "ppm"
) typically produced by the maximum
pseudolikelihood fitting algorithm ppm
).
The argument type
selects the type of residual or weight
that will be computed. Current options are:
The argument which
selects the type of plot that is
produced. Options are:
The argument rbord
ensures there are no edge
effects in the computation of the residuals. The diagnostic calculations
will be confined to those points of the data pattern which are
at least rbord
units away from the edge of the window.
The value of rbord
should be greater than or equal to
the range of interaction permitted in the model.
By default, the two-standard-deviation limits are calculated
from the exact formula for the asymptotic variance
of the residuals under the asymptotic normal approximation,
equation (37) of Baddeley et al (2006).
However, for compatibility with the original paper
of Baddeley et al (2005), if oldstyle=TRUE
,
the two-standard-deviation limits are calculated
using the innovation variance, an over-estimate of the true
variance of the residuals. (However, see the section about
Replicated Data).
The argument rv
would normally be used only by experts.
It enables the user to substitute arbitrary values for the
residuals or marks, overriding the usual calculations.
If rv
is present, then instead of calculating the residuals from
the fitted model, the algorithm takes the residuals from the object
rv
, and plots them in the manner appropriate to the type of residual
or mark selected by type
. If type ="eem"
then
rv
should be similar to the return value of eem
,
namely, a numeric vector of length equal to
the number of points in the original data point pattern.
Otherwise, rv
should be similar to the return value of
residuals.ppm
, that is, it should be an object of
class "msr"
(see msr
) representing a signed
measure.
The return value of diagnose.ppm
is an object of class "diagppm"
.
The plot
method for this class is documented here.
There is also a print
method. See the Examples.
In plot.diagppm
,
if a four-panel diagnostic plot is produced (the default), then
the extra arguments xlab
, ylab
, rlab
determine the
text labels for the $x$ and $y$ coordinates
and the residuals, respectively.
The undocumented arguments col.neg
and col.smooth
control the colour maps used in the top left and bottom right
panels respectively.
See also the companion functions qqplot.ppm
, which produces a
Q-Q plot of the residuals, and lurking
, which produces
lurking variable plots for any spatial covariate.
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. Stoyan, D. and Grabarnik, P. (1991) Second-order characteristics for stochastic structures connected with Gibbs point processes. Mathematische Nachrichten, 151:95--100.
residuals.ppm
,
eem
,
ppm.object
,
qqplot.ppm
,
lurking
,
ppm
fit <- ppm(cells ~x, Strauss(r=0.15))
diagnose.ppm(fit)
## Not run:
# diagnose.ppm(fit, type="pearson")
# ## End(Not run)
diagnose.ppm(fit, which="marks")
diagnose.ppm(fit, type="raw", plot.neg="discrete")
diagnose.ppm(fit, type="pearson", which="smooth")
# save the diagnostics and plot them later
u <- diagnose.ppm(fit, rbord=0.15, plot.it=FALSE)
## Not run:
# plot(u)
# plot(u, which="marks")
# ## End(Not run)
Run the code above in your browser using DataLab