Simulation envelopes can be used to assess the goodness-of-fit of
a point process model to point pattern data. See the References. This function first generates nsim
random point patterns
in one of the following ways.
- If
Y
is a point pattern (an object of class"ppp"
)
andsimulate=NULL
,
then this routine generatesnsim
simulations of
Complete Spatial Randomness (i.e.nsim
simulated point patterns
each being a realisation of the uniform Poisson point process)
with the same intensity as the patternY
. - If
Y
is a fitted point process model (an object of class"ppm"
) andsimulate=NULL
,
then this routine generatesnsim
simulated
realisations of that model. - If
simulate
is supplied, then it must be
an expression. It will be evaluatednsim
times to
yieldnsim
point patterns.
The summary statistic fun
is applied to each of these simulated
patterns. Typically fun
is one of the functions
Kest
, Gest
, Fest
, Jest
, pcf
,
Kcross
, Kdot
, Gcross
, Gdot
,
Jcross
, Jdot
, Kmulti
, Gmulti
,
Jmulti
or Kinhom
. It may also be a character string
containing the name of one of these functions. The statistic fun
can also be a user-supplied function;
if so, then it must have arguments X
and r
like those in the functions listed above, and it must return an object
of class "fv"
.
Upper and lower pointwise envelopes are computed pointwise (i.e.
for each value of the distance argument $r$), by sorting the
nsim
simulated values, and taking the m
-th lowest
and m
-th highest values, where m = nrank
.
For example if nrank=1
, the upper and lower envelopes
are the pointwise maximum and minimum of the simulated values.
The significance level of the associated Monte Carlo test is
alpha = 2 * nrank/(1 + nsim)
.
The return value is an object of class "fv"
containing
the summary function for the data point pattern
and the upper and lower simulation envelopes. It can be plotted
using plot.fv
.
Arguments can be passed to the function fun
through
...
. This makes it possible to select the edge correction
used to calculate the summary statistic. See the Examples.
If Y
is a fitted point process model, and simulate=NULL
,
then the model is simulated
by running the Metropolis-Hastings algorithm rmh
.
Complete control over this algorithm is provided by the
arguments start
and control
which are passed
to rmh
.
Selecting only a single edge
correction will make the code run much faster.