Appendix 6.2: Simulating point patterns

The spatstat package contains functions to simulate the main point processes, such as the homogeneous and inhomogeneous Poisson processes, Cox processes, Poisson cluster processes, Matern processes, simple sequential inhibition processes and Strauss processes.

Appendix 6.2.1: Homogeneous Poisson processes

A homogeneous Poisson process with given constant first-order intensity in a given study area can be simulated using the function rpoisp, which requires at least the arguments lambda, that is the value of the first-order intensity, and win, that is the study area that can be specified as in the ppp function. The result is a ppp object. For example, a realization of a homogeneous Poisson process with intensity 50 in a unit square can be obtained with:

> csrpattern <- rpoispp(lambda=50, win=owin(c(0,1),c(0,1)))

> plot(csrpattern)

Appendix 6.2.2: Inhomogeneous Poisson processes

The function rpoispp can be used also to simulate inhomogeneous Poisson processes by making the argument lambda equal to a function or a pixel image, instead of a constant value, that provide the differing values of the first-order intensity. For example, if we type:

> lambdaFun <- function(x,у) {хл2+ул2}

> inhompat <- rpoispp(lambda=lambdaFun, win=owin(c(0,4),c(0,4)))

> plot(inhompat)

we obtain a partial realization of an inhomogeneous Poisson process on a square of side of 4 units with spatially varying intensity function X (x, %2) = xf + x.

Appendix 6.2.3: Cox processes

The spatstat function rLGCP allows us to simulate the log-Gaussian Cox process. It makes use of at least three arguments: mu, var and model, which are the mean, variance and covariance function, respectively, of the underlying Gaussian process for the intensity. In order to specify the exponential covariance function, model has to be set equal to “exp”; otherwise, for instance, model=“matern” gives the Whittle-Matern specification. To see the complete list of the available functional forms for the covariance function type?rLGCP. Depending on the choice of the covariance function, it is also possible to use the argument scale. For example, the following code allows to obtain a partial realization of a log-Gaussian Cox process on a unit square with mean p =4, variance <72 =0.25 and correlation function p(d) = exp{-

> LGCPpattern <- rLGCP(model="exp", mu=4, var=0.25, scale=0.2,+ win=owin(c(0,l),c(0,1)))

> plot(LGCPpattern)

< Prev   CONTENTS   Source   Next >