This session is concerned with evelopes of summary statistics and Monte Carlo tests.

The lecturerâ€™s R script is available here (right click and save).

### Exercise 1

For the `swedishpines`

data:

Plot the \(K\) function along with pointwise envelopes from 39 simulations of CSR:

`plot(envelope(swedishpines, Kest, nsim=39))`

Plot the \(L\) function along with pointwise envelopes from 39 simulations of CSR.

Plot the \(L\) function along with **simultaneous** envelopes from **19** simulations of CSR, using `ginterval=c(0,0.5)`

.

Plot the \(L\) function for along with **simultaneous** envelopes from **99** simulations of CSR using `ginterval=c(0,0.5)`

. What is the significance level of the associated test?

### Exercise 2

To understand the difficulties with the \(K\)-function when the point pattern is not spatially homogeneous, try the following experiment (like in the previous lab session).

Generate a simulated realisation of an inhomogeneous Poisson process, e.g.

`X <- rpoispp(function(x,y){ 200 * exp(-3 * x) })`

Compute simulation envelopes (of your favorite type) of the \(K\)- or \(L\)-function under CSR. They may well indicate significant departure from CSR.

Fit a Poisson point process model to the `japanesepines`

data with log-quadratic trend (formula `~polynom(x,y,2)`

). Plot the \(L\)-function of the data along with simultaneous envelopes from 99 simulations **of the fitted model**.