| rLGCP | R Documentation |
Generate a random point pattern, a realisation of the log-Gaussian Cox process.
rLGCP(model=c("exponential", "gauss", "stable", "gencauchy", "matern"),
mu = 0, param = NULL,
...,
win=NULL, saveLambda=TRUE, nsim=1, drop=TRUE,
n.cond=NULL, w.cond=NULL)
model |
character string (partially matched) giving the name of a covariance model for the Gaussian random field. |
mu |
mean function of the Gaussian random field. Either a
single number, a |
param |
List of parameters for the covariance.
Standard arguments are |
... |
Additional parameters for the covariance,
or arguments passed to |
win |
Window in which to simulate the pattern.
An object of class |
saveLambda |
Logical. If |
nsim |
Number of simulated realisations to be generated. |
drop |
Logical. If |
n.cond |
Optional. Integer specifying a fixed number of points. See the section on Conditional Simulation. |
w.cond |
Optional. Conditioning region. A window (object of class |
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 ....
All models recognise the parameters var
for the variance at distance zero, and scale for the scale
parameter. Some models require additional parameters which are listed
below.
The available models are as follows:
model="exponential":the exponential covariance function
C(r) = \sigma^2 \exp(-r/h)
where \sigma^2 is the variance parameter var,
and h is the scale parameter scale.
model="gauss":the Gaussian covariance function
C(r) = \sigma^2 \exp(-(r/h)^2)
where \sigma^2 is the variance parameter var,
and h is the scale parameter scale.
model="stable":the stable covariance function
C(r) = \sigma^2 \exp(-(r/h)^\alpha)
where \sigma^2 is the variance parameter var,
h is the scale parameter scale,
and \alpha is the shape parameter alpha.
The parameter alpha must be given, either as a stand-alone
argument, or as an entry in the list param.
model="gencauchy":the generalised Cauchy covariance function
C(r) = \sigma^2 (1 + (x/h)^\alpha)^{-\beta/\alpha}
where \sigma^2 is the variance parameter var,
h is the scale parameter scale,
and \alpha and \beta are the shape parameters
alpha and beta.
The parameters alpha and beta
must be given, either as stand-alone arguments, or as entries
in the list param.
model="matern":the Whittle-\Matern covariance function
C(r) = \sigma^2 \frac{1}{2^{\nu-1} \Gamma(\nu)}
(\sqrt{2 \nu} \, r/h)^\nu K_\nu(\sqrt{2\nu}\, r/h)
where \sigma^2 is the variance parameter var,
h is the scale parameter scale,
and \nu is the shape parameter nu.
The parameter nu must be given, either as a stand-alone
argument, or as an entry in the list param.
The algorithm uses the circulant embedding technique 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.random 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.
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.
If n.cond is specified, it should be a single integer.
Simulation will be conditional on the event
that the pattern contains exactly n.cond points
(or contains exactly n.cond points inside
the region w.cond if it is given).
Conditional simulation uses the rejection algorithm described
in Section 6.2 of Moller, Syversveen and Waagepetersen (1998).
There is a maximum number of proposals which will be attempted.
Consequently the return value may contain fewer
than nsim point patterns.
The simulation algorithm for rLGCP has been completely re-written
in spatstat.random version 3.2-0 to avoid depending on
the package RandomFields which is now defunct (and is sadly missed).
It is no longer possible to replicate results that were obtained using
rLGCP in previous versions of spatstat.random.
The current code is a new implementation and should be considered vulnerable to new bugs.
Abdollah Jalilian and Rasmus Waagepetersen. Modified by \spatstatAuthors.
, J., Syversveen, A. and Waagepetersen, R. (1998) Log Gaussian Cox Processes. Scandinavian Journal of Statistics 25, 451–482.
rpoispp,
rMatClust,
rGaussPoisson,
rNeymanScott.
For fitting the model, see kppm,
lgcp.estK.
online <- interactive()
# 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.1)
if(online) {
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)))
if(online) plot(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.