Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rLGCP

Simulate Log-Gaussian Cox Process


Description

Generate a random point pattern, a realisation of the log-Gaussian Cox process.

Usage

rLGCP(model="exp", mu = 0, param = NULL,
       ...,
       win=NULL, saveLambda=TRUE, nsim=1, drop=TRUE)

Arguments

model

character string: the short name of a covariance model for the Gaussian random field. After adding the prefix "RM", the code will search for a function of this name in the RandomFields package.

mu

mean function of the Gaussian random field. Either a single number, a function(x,y, ...) or a pixel image (object of class "im").

param

List of parameters for the covariance. Standard arguments are var and scale.

...

Additional parameters for the covariance, or arguments passed to as.mask to determine the pixel resolution.

win

Window in which to simulate the pattern. An object of class "owin".

saveLambda

Logical. If TRUE (the default) then the simulated random intensity will also be saved, and returns as an attribute of the point pattern.

nsim

Number of simulated realisations to be generated.

drop

Logical. If nsim=1 and drop=TRUE (the default), the result will be a point pattern, rather than a list containing a point pattern.

Details

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 μ 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.

Value

A point pattern (object of class "ppp") or a list of point patterns.

Additionally, the simulated intensity function for each point pattern is returned as an attribute "Lambda" of the point pattern, if saveLambda=TRUE.

Author(s)

Abdollah Jalilian and Rasmus Waagepetersen. Modified by Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

References

Moller, J., Syversveen, A. and Waagepetersen, R. (1998) Log Gaussian Cox Processes. Scandinavian Journal of Statistics 25, 451–482.

See Also

Examples

if(require(RandomFields)) {
  # homogeneous LGCP with exponential covariance function
  X <- rLGCP("exp", 3, var=0.2, scale=.1)

  # inhomogeneous LGCP with Gaussian covariance function
  m <- as.im(function(x, y){5 - 1.5 * (x - 0.5)^2 + 2 * (y - 0.5)^2}, W=owin())
  X <- rLGCP("gauss", m, var=0.15, scale =0.5)
  plot(attr(X, "Lambda"))
  points(X)

  # inhomogeneous LGCP with Matern covariance function
  X <- rLGCP("matern", function(x, y){ 1 - 0.4 * x},
             var=2, scale=0.7, nu=0.5,
             win = owin(c(0, 10), c(0, 10)))
  plot(X)
  }

spatstat.core

Core Functionality of the 'spatstat' Family

v2.1-2
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Kasper Klitgaard Berthelsen [ctb], Achmad Choiruddin [ctb], Jean-Francois Coeurjolly [ctb], Ottmar Cronie [ctb], Tilman Davies [ctb], Julian Gilbey [ctb], Yongtao Guan [ctb], Ute Hahn [ctb], Kassel Hingee [ctb], Abdollah Jalilian [ctb], Marie-Colette van Lieshout [ctb], Greg McSwiggan [ctb], Tuomas Rajala [ctb], Suman Rakshit [ctb], Dominic Schuhmacher [ctb], Rasmus Plenge Waagepetersen [ctb], Hangsheng Wang [ctb]
Initial release
2021-04-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.