Computes the global envelopes corresponding to the Dao-Genton test of goodness-of-fit.

```
dg.envelope(X, ...,
nsim = 19, nsimsub=nsim-1, nrank = 1,
alternative=c("two.sided", "less", "greater"),
leaveout=1, interpolate = FALSE,
savefuns=FALSE, savepatterns=FALSE,
verbose = TRUE)
```

An object of class `"fv"`

.

- X
Either a point pattern dataset (object of class

`"ppp"`

,`"lpp"`

or`"pp3"`

) or a fitted point process model (object of class`"ppm"`

,`"kppm"`

or`"slrm"`

).- ...
Arguments passed to

`mad.test`

or`envelope`

to control the conduct of the test. Useful arguments include`fun`

to determine the summary function,`rinterval`

to determine the range of \(r\) values used in the test, and`verbose=FALSE`

to turn off the messages.- nsim
Number of simulated patterns to be generated in the primary experiment.

- nsimsub
Number of simulations in each basic test. There will be

`nsim`

repetitions of the basic test, each involving`nsimsub`

simulated realisations, so there will be a total of`nsim * (nsimsub + 1)`

simulations.- nrank
Integer. Rank of the envelope value amongst the

`nsim`

simulated values. A rank of 1 means that the minimum and maximum simulated values will be used.- alternative
Character string determining whether the envelope corresponds to a two-sided test (

`alternative="two.sided"`

, the default) or a one-sided test with a lower critical boundary (`alternative="less"`

) or a one-sided test with an upper critical boundary (`alternative="greater"`

).- leaveout
Optional integer 0, 1 or 2 indicating how to calculate the deviation between the observed summary function and the nominal reference value, when the reference value must be estimated by simulation. See Details.

- interpolate
Logical value indicating whether to interpolate the distribution of the test statistic by kernel smoothing, as described in Dao and Genton (2014, Section 5).

- savefuns
Logical flag indicating whether to save the simulated function values (from the first stage).

- savepatterns
Logical flag indicating whether to save the simulated point patterns (from the first stage).

- verbose
Logical value determining whether to print progress reports.

Adrian Baddeley, Andrew Hardegen, Tom Lawrence, Robin Milne, Gopalan Nair and Suman Rakshit. Implemented by Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

Computes global simulation envelopes corresponding to the Dao-Genton (2014) adjusted Monte Carlo goodness-of-fit test. The envelopes were developed in Baddeley et al (2015) and described in Baddeley, Rubak and Turner (2015).

If `X`

is a point pattern, the null hypothesis is CSR.

If `X`

is a fitted model, the null hypothesis is that model.

The Dao-Genton test is biased when the significance level is very small
(small \(p\)-values are not reliable) and
we recommend `bits.envelope`

in this case.

Dao, N.A. and Genton, M. (2014)
A Monte Carlo adjusted goodness-of-fit test for
parametric models describing spatial point patterns.
*Journal of Graphical and Computational Statistics*
**23**, 497--517.

Baddeley, A., Hardegen, A., Lawrence, L., Milne, R.K., Nair, G.M. and Rakshit, S. (2015) Pushing the envelope: extensions of graphical Monte Carlo tests. Unpublished manuscript.

Baddeley, A., Rubak, E. and Turner, R. (2015) *Spatial Point Patterns: Methodology and Applications with R*. Chapman and Hall/CRC Press.

`dg.test`

,
`mad.test`

,
`envelope`

```
ns <- if(interactive()) 19 else 4
E <- dg.envelope(swedishpines, Lest, nsim=ns)
E
plot(E)
Eo <- dg.envelope(swedishpines, Lest, alternative="less", nsim=ns)
Ei <- dg.envelope(swedishpines, Lest, interpolate=TRUE, nsim=ns)
```

Run the code above in your browser using DataLab