# dg.progress

##### Progress Plot of Dao-Genton Test of Spatial Pattern

Generates a progress plot (envelope representation) of the Dao-Genton test for a spatial point pattern.

##### Usage

```
dg.progress(X, fun = Lest, …,
exponent = 2, nsim = 19, nsimsub = nsim - 1,
nrank = 1, alpha, leaveout=1, interpolate = FALSE, rmin=0,
savefuns = FALSE, savepatterns = FALSE, verbose=TRUE)
```

##### Arguments

- X
Either a point pattern (object of class

`"ppp"`

,`"lpp"`

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

,`"kppm"`

or other class) or an envelope object (class`"envelope"`

).- fun
Function that computes the desired summary statistic for a point pattern.

- …
Arguments passed to

`envelope`

. Useful arguments include`alternative`

to specify one-sided or two-sided envelopes.- exponent
Positive number. The exponent of the \(L^p\) distance. See Details.

- nsim
Number of repetitions of the basic test.

- 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. The rank of the critical value of the Monte Carlo test, amongst the

`nsim`

simulated values. A rank of 1 means that the minimum and maximum simulated values will become the critical values for the test.- alpha
Optional. The significance level of the test. Equivalent to

`nrank/(nsim+1)`

where`nsim`

is the number of simulations.- 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 how to compute the critical value. If

`interpolate=FALSE`

(the default), a standard Monte Carlo test is performed, and the critical value is the largest simulated value of the test statistic (if`nrank=1`

) or the`nrank`

-th largest (if`nrank`

is another number). If`interpolate=TRUE`

, kernel density estimation is applied to the simulated values, and the critical value is the upper`alpha`

quantile of this estimated distribution.- rmin
Optional. Left endpoint for the interval of \(r\) values on which the test statistic is calculated.

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

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

- verbose
Logical value indicating whether to print progress reports.

##### Details

The Dao and Genton (2014) test for a spatial point pattern
is described in `dg.test`

.
This test depends on the choice of an interval of
distance values (the argument `rinterval`

).
A *progress plot* or *envelope representation*
of the test (Baddeley et al, 2014) is a plot of the
test statistic (and the corresponding critical value) against the length of
the interval `rinterval`

.

The command `dg.progress`

effectively performs
`dg.test`

on `X`

using all possible intervals
of the form \([0,R]\), and returns the resulting values of the test
statistic, and the corresponding critical values of the test,
as a function of \(R\).

The result is an object of class `"fv"`

that can be plotted to obtain the progress plot. The display shows
the test statistic (solid black line) and the test
acceptance region (grey shading).
If `X`

is an envelope object, then some of the data stored
in `X`

may be re-used:

If

`X`

is an envelope object containing simulated functions, and`fun=NULL`

, then the code will re-use the simulated functions stored in`X`

.If

`X`

is an envelope object containing simulated point patterns, then`fun`

will be applied to the stored point patterns to obtain the simulated functions. If`fun`

is not specified, it defaults to`Lest`

.Otherwise, new simulations will be performed, and

`fun`

defaults to`Lest`

.

If the argument `rmin`

is given, it specifies the left endpoint
of the interval defining the test statistic: the tests are
performed using intervals \([r_{\mbox{\scriptsize min}},R]\)
where \(R \ge r_{\mbox{\scriptsize min}}\).

The argument `leaveout`

specifies how to calculate the
discrepancy between the summary function for the data and the
nominal reference value, when the reference value must be estimated
by simulation. The values `leaveout=0`

and
`leaveout=1`

are both algebraically equivalent (Baddeley et al, 2014,
Appendix) to computing the difference `observed - reference`

where the `reference`

is the mean of simulated values.
The value `leaveout=2`

gives the leave-two-out discrepancy
proposed by Dao and Genton (2014).

##### Value

An object of class `"fv"`

that can be plotted to
obtain the progress plot.

##### References

Baddeley, A., Diggle, P., Hardegen, A., Lawrence, T.,
Milne, R. and Nair, G. (2014)
On tests of spatial pattern based on simulation envelopes.
*Ecological Monographs* **84** (3) 477--489.

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. Submitted for publication.

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.

##### See Also

##### Examples

```
# NOT RUN {
ns <- if(interactive()) 19 else 5
plot(dg.progress(cells, nsim=ns))
# }
```

*Documentation reproduced from package spatstat, version 1.63-0, License: GPL (>= 2)*