[R-sig-Geo] Plotting envelopes of a fitted Strauss Model

Adrian.Baddeley at csiro.au Adrian.Baddeley at csiro.au
Mon Mar 22 06:23:09 CET 2010


salma anwar <salmaaries at hotmail.com> writes:

> When I try to plot the envelopes of a fitted multitype Strauss model, I get an error message. 
> Can somebody please give clues about what could be the reason?
> Below is the code and the error message:
> plot (envelope (modelA, Kest, nsim=99, global=TRUE))
> Error in rmh.default(rmodel, rstart, rcontr, preponly = TRUE, verbose = FALSE) :
>  Expanded simulation window is not contained in several of the trend windows.
> Bailing out.

*short answer*: type
       plot (envelope (modelA, Kest, nsim=99, global=TRUE, control=list(expand=1,nrep=1e5))

*long answer*:

Which version of spatstat are you using? (The envelope command has been completely restructured in version 1.18-0 and 1.18-1).

You didn't provide the code that created the fitted model, 'modelA'. My guess is that 'modelA' involves covariates that were supplied as pixel images. 

When you run the envelope command on a fitted model (other than a Poisson model), the simulated patterns are generated using rmh(). The behaviour of rmh() is controlled by the arguments 'start' and 'control' (which are passed from envelope() to rmh()). If you look at help(envelope) it says that the default values are start=NULL and control=list(expand=1.5, nrep=1e5). The parameter 'nrep' controls the number of iterations of the Metropolis-Hastings algorithm. The parameter 'expand' determines the window in which simulated patterns are generated. By default, rmh generates simulated patterns on a window that is larger than the original data window, to reduce edge effects: this is called 'expansion'. 

If the model depends on covariates, then in order to simulate point patterns from the model, rmh() must know the values of the covariates in the window where the point process is to be simulated. The error message from rmh.default says that the (default) expanded simulation window is larger than the domain of the covariate images in modelA.

The simplest solution is to tell rmh not to expand the simulation window. You do this by setting 
 control=list(nrep=1e5, expand=1) which signifies no expansion (when 'expand' is a number, it is interpreted as the ratio of expanded area to original area, so a value of 1 means no expansion). 

Alternatively if you do have data giving the covariate values on a larger domain, you could use this data
For more information, see help(envelope), help(rmh.default) and help(rmhcontrol).

Adrian Baddeley


More information about the R-sig-Geo mailing list