library(spatstat)

Exercise 1

The swedishpines dataset was recorded in a study plot in a large forest. We shall assume the pattern is stationary.

  1. Calculate the estimate of the \(K\)-function using Kest.

    The estimation is done with:

    K <- Kest(swedishpines)
  2. Plot the estimate of \(K(r)\) against \(r\)

    To plot the K-function, we do:

    plot(K, main = "K-function")

  3. Plot the estimate of \(K(r) - \pi\!r^2\) against \(r\) (Hint: look at the fmla argument in plot.fv).

    The estimated K-function subtracted \(\pi\!r^2\) can be done via the fmla (formula) interface:

    plot(K, . - pi*r^2 ~ r, main = "Normalized K-function",
         legendpos = "bottomright")

  4. Calculate and plot an estimate of the pair correlation function using pcf.

    The pair-correlation is also compute straight-forwardly:

    pcorf <- pcf(swedishpines)
    plot(pcorf)

  5. Draw tentative conclusions from these plots about interpoint interaction in the data.

    Assuming a homogeneous point pattern, both the L- and K-function are less what is expected under the Poisson process the data. Thus they indicate a comparatively regular point pattern. Similarly, the pair-correlation function also suggests this.

Exercise 2

The command rThomas generates simulated realisations of the Thomas model (‘modified Thomas cluster process’).

  1. Read the help file.

    See help("rThomas").

  2. Type plot(rThomas(10, 0.05, 8)) a few times, and interpret the results.

    replicate(3, plot(rThomas(10, 0.05, 8), main = ""))