This function generates a realisation of a log-Gaussian Cox
process (LGCP). This is a Cox point process in which
the logarithm of the random intensity is a Gaussian random
field with mean function \(\mu\) and covariance function
\(c(r)\). Conditional on the random intensity, the point process
is a Poisson process with this intensity.

The string `model`

specifies the covariance
function of the Gaussian random field, and the parameters
of the covariance are determined by `param`

and `…`

.

To determine the covariance model, the string `model`

is prefixed by `"RM"`

, and a function of this name is
sought in the RandomFields package.
For a list of available models see
`RMmodel`

in the
RandomFields package. For example the
Matern covariance is specified by `model="matern"`

, corresponding
to the function `RMmatern`

in the RandomFields package.

Standard variance parameters (for all functions beginning with
`"RM"`

in the RandomFields package) are `var`

for the variance at distance zero, and `scale`

for the scale
parameter. Other parameters are specified in the help files
for the individual functions beginning with `"RM"`

. For example
the help file for `RMmatern`

states that `nu`

is a parameter
for this model.

This algorithm uses the function `RFsimulate`

in the
RandomFields package to generate values of
a Gaussian random field, with the specified mean function `mu`

and the covariance specified by the arguments `model`

and
`param`

, on the points of a regular grid. The exponential
of this random field is taken as the intensity of a Poisson point
process, and a realisation of the Poisson process is then generated by the
function `rpoispp`

in the spatstat package.

If the simulation window `win`

is missing or `NULL`

,
then it defaults to
`Window(mu)`

if `mu`

is a pixel image,
and it defaults to the unit square otherwise.

The LGCP model can be fitted to data using `kppm`

.