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

simulate.ppm

Simulate a Fitted Gibbs Point Process Model


Description

Generates simulated realisations from a fitted Gibbs or Poisson point process model.

Usage

## S3 method for class 'ppm'
simulate(object, nsim=1, ...,
                         singlerun = FALSE,
                         start = NULL,
                         control = default.rmhcontrol(object, w=w),
                         w = window, 
                         window = NULL, 
                         project=TRUE, new.coef=NULL,
                         verbose=FALSE, progress=(nsim > 1),
                         drop=FALSE)

Arguments

object

Fitted point process model. An object of class "ppm".

nsim

Number of simulated realisations.

singlerun

Logical. Whether to generate the simulated realisations from a single long run of the Metropolis-Hastings algorithm (singlerun=TRUE) or from separate, independent runs of the algorithm (singlerun=FALSE, the default).

start

Data determining the initial state of the Metropolis-Hastings algorithm. See rmhstart for description of these arguments. Defaults to list(n.start=npoints(data.ppm(object))) meaning that the initial state of the algorithm has the same number of points as the original dataset.

control

Data controlling the running of the Metropolis-Hastings algorithm. See rmhcontrol for description of these arguments.

w, window

Optional. The window in which the model is defined. An object of class "owin".

...

Further arguments passed to rmhcontrol, or to rmh.default, or to covariate functions in the model.

project

Logical flag indicating what to do if the fitted model is invalid (in the sense that the values of the fitted coefficients do not specify a valid point process). If project=TRUE the closest valid model will be simulated; if project=FALSE an error will occur.

verbose

Logical flag indicating whether to print progress reports from rmh.ppm during the simulation of each point pattern.

progress

Logical flag indicating whether to print progress reports for the sequence of simulations.

new.coef

New values for the canonical parameters of the model. A numeric vector of the same length as coef(object).

drop

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

Details

This function is a method for the generic function simulate for the class "ppm" of fitted point process models.

Simulations are performed by rmh.ppm.

If singlerun=FALSE (the default), the simulated patterns are the results of independent runs of the Metropolis-Hastings algorithm. If singlerun=TRUE, a single long run of the algorithm is performed, and the state of the simulation is saved every nsave iterations to yield the simulated patterns.

In the case of a single run, the behaviour is controlled by the parameters nsave,nburn,nrep. These are described in rmhcontrol. They may be passed in the ... arguments or included in control. It is sufficient to specify two of the three parameters nsave,nburn,nrep.

Value

A list of length nsim containing simulated point patterns (objects of class "ppp"). It also belongs to the class "solist", so that it can be plotted, and the class "timed", so that the total computation time is recorded.

Author(s)

See Also

Examples

fit <- ppm(japanesepines, ~1, Strauss(0.1))
  simulate(fit, 2)
  simulate(fit, 2, singlerun=TRUE, nsave=1e4, nburn=1e4)

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.