R: The spatstat.random Package

spatstat.random-package {spatstat.random} | R Documentation

## The spatstat.random Package

### Description

The spatstat.random package belongs to the spatstat family of packages. It contains the functionality for generating random spatial patterns and simulation of random point processes.

### Details

spatstat is a family of R packages for the statistical analysis of spatial data. Its main focus is the analysis of spatial patterns of points in two-dimensional space.

This sub-package spatstat.random contains the functions that perform random generation of spatial patterns and simulation of random point processes:

- generating random spatial patterns of points according to many simple rules (complete spatial randomness, Poisson, binomial, random grid, systematic, cell);

- randomised alteration of spatial patterns (thinning, random shifting, jittering, random labelling);

- simulated realisations of random point processes (simple sequential inhibition, Matern inhibition models, Matern cluster process, Neyman-Scott cluster processes, log-Gaussian Cox processes, product shot noise cluster processes);

- simulation of Gibbs point processes (Metropolis-Hastings birth-death-shift algorithm, perfect simulation/ dominated coupling from the past, alternating Gibbs sampler);

- generating random spatial patterns of line segments;

- generating random tessellations;

- generating random images (random noise, random mosaics).

(Functions for linear networks are in the separate sub-package spatstat.linnet.)

### Structure of the spatstat family

The spatstat family of packages is designed to support a complete statistical analysis of spatial data. It supports

- creation, manipulation and plotting of point patterns;

- exploratory data analysis;

- spatial random sampling;

- simulation of point process models;

- parametric model-fitting;

- non-parametric smoothing and regression;

- formal inference (hypothesis tests, confidence intervals);

- model diagnostics.

The orginal spatstat package grew to be very large. It has now been divided into several sub-packages:

- spatstat.utils containing basic utilities

- spatstat.sparse containing linear algebra utilities

- spatstat.data containing datasets

- spatstat.geom containing geometrical objects and geometrical operations

- spatstat.random containing functionality for simulation and random generation

- spatstat.core containing the main functionality for statistical analysis and modelling of spatial data

- spatstat.linnet containing functions for spatial data on a linear network

- spatstat, which simply loads the other sub-packages listed above, and provides documentation.

When you install spatstat, these sub-packages are also installed. Then if you load the spatstat package by typing `library(spatstat)`, the other sub-packages listed above will automatically be loaded or imported.

For an overview of all the functions available in the sub-packages of spatstat, see the help file for `"spatstat-package"` in the spatstat package.

Additionally there are several extension packages:

- spatstat.gui for interactive graphics

- spatstat.local for local likelihood (including geographically weighted regression)

- spatstat.Knet for additional, computationally efficient code for linear networks

- spatstat.sphere (under development) for spatial data on a sphere, including spatial data on the earth's surface

The extension packages must be installed separately and loaded explicitly if needed. They also have separate documentation.

### Functionality in spatstat.random

Following is a list of the functionality provided in the spatstat.random package only.

To simulate a random point pattern:

`runifpoint` | generate n independent uniform random points
`rpoint` | generate n independent random points
`rmpoint` | generate n independent multitype random points
`rpoispp` | simulate the (in)homogeneous Poisson point process
`rmpoispp` | simulate the (in)homogeneous multitype Poisson point process
`runifdisc` | generate n independent uniform random points in disc
`rstrat` | stratified random sample of points
`rMaternI` | simulate the Matern Model I inhibition process
`rMaternII` | simulate the Matern Model II inhibition process
`rSSI` | simulate Simple Sequential Inhibition process
`rStrauss` | simulate Strauss process (perfect simulation)
`rHardcore` | simulate Hard Core process (perfect simulation)
`rStraussHard` | simulate Strauss-hard core process (perfect simulation)
`rDiggleGratton` | simulate Diggle-Gratton process (perfect simulation)
`rDGS` | simulate Diggle-Gates-Stibbard process (perfect simulation)
`rPenttinen` | simulate Penttinen process (perfect simulation)
`rNeymanScott` | simulate a general Neyman-Scott process
`rPoissonCluster` | simulate a general Poisson cluster process
`rMatClust` | simulate the Matern Cluster process
`rThomas` | simulate the Thomas process
`rGaussPoisson` | simulate the Gauss-Poisson cluster process
`rCauchy` | simulate Neyman-Scott Cauchy cluster process
`rVarGamma` | simulate Neyman-Scott Variance Gamma cluster process
`rthin` | random thinning
`rcell` | simulate the Baddeley-Silverman cell process
`rmh` | simulate Gibbs point process using Metropolis-Hastings
`runifpointOnLines` | generate n random points along specified line segments
`rpoisppOnLines` | generate Poisson random points along specified line segments

To randomly change an existing point pattern:

`rshift` | random shifting of points
`rthin` | random thinning
`rlabel` | random (re)labelling of a multitype point pattern
`quadratresample` | block resampling

Random pixel images:

An object of class `"im"` represents a pixel image.

`rnoise` | random pixel noise

Line segment patterns

An object of class `"psp"` represents a pattern of straight line segments.

`rpoisline` | generate a realisation of the Poisson line process inside a window

Tessellations

An object of class `"tess"` represents a tessellation.

`rpoislinetess` | generate tessellation using Poisson line process

Three-dimensional point patterns

An object of class `"pp3"` represents a three-dimensional point pattern in a rectangular box. The box is represented by an object of class `"box3"`.

`runifpoint3` | generate uniform random points in 3-D
`rpoispp3` | generate Poisson random points in 3-D

Multi-dimensional space-time point patterns

An object of class `"ppx"` represents a point pattern in multi-dimensional space and/or time.

`runifpointx` | generate uniform random points
`rpoisppx` | generate Poisson random points

Probability Distributions

`rknn` | theoretical distribution of nearest neighbour distance
`dmixpois` | mixed Poisson distribution

Simulation

There are many ways to generate a random point pattern, line segment pattern, pixel image or tessellation in spatstat.

Random point patterns:

`runifpoint` | generate n independent uniform random points
`rpoint` | generate n independent random points
`rmpoint` | generate n independent multitype random points
`rpoispp` | simulate the (in)homogeneous Poisson point process
`rmpoispp` | simulate the (in)homogeneous multitype Poisson point process
`runifdisc` | generate n independent uniform random points in disc
`rstrat` | stratified random sample of points
`rMaternI` | simulate the Matern Model I inhibition process
`rMaternII` | simulate the Matern Model II inhibition process
`rSSI` | simulate Simple Sequential Inhibition process
`rHardcore` | simulate hard core process (perfect simulation)
`rStrauss` | simulate Strauss process (perfect simulation)
`rStraussHard` | simulate Strauss-hard core process (perfect simulation)
`rDiggleGratton` | simulate Diggle-Gratton process (perfect simulation)
`rDGS` | simulate Diggle-Gates-Stibbard process (perfect simulation)
`rPenttinen` | simulate Penttinen process (perfect simulation)
`rNeymanScott` | simulate a general Neyman-Scott process
`rMatClust` | simulate the Matern Cluster process
`rThomas` | simulate the Thomas process
`rLGCP` | simulate the log-Gaussian Cox process
`rGaussPoisson` | simulate the Gauss-Poisson cluster process
`rCauchy` | simulate Neyman-Scott process with Cauchy clusters
`rVarGamma` | simulate Neyman-Scott process with Variance Gamma clusters
`rcell` | simulate the Baddeley-Silverman cell process
`runifpointOnLines` | generate n random points along specified line segments
`rpoisppOnLines` | generate Poisson random points along specified line segments

Resampling a point pattern:

`quadratresample` | block resampling
`rshift` | random shifting of (subsets of) points
`rthin` | random thinning

Other random patterns:

`rpoisline` | simulate the Poisson line process within a window
`rpoislinetess` | generate random tessellation using Poisson line process
`rMosaicSet` | generate random set by selecting some tiles of a tessellation
`rMosaicField` | generate random pixel image by assigning random values in each tile of a tessellation

Resampling and randomisation procedures

You can build your own tests based on randomisation and resampling using the following capabilities:

`quadratresample` | block resampling
`rshift` | random shifting of (subsets of) points
`rthin` | random thinning

### Licence

This library and its documentation are usable under the terms of the "GNU General Public License", a copy of which is distributed with the package.

### Acknowledgements

Kasper Klitgaard Berthelsen, Tilman Davies, Ute Hahn, Abdollah Jalilian, and Rasmus Waagepetersen made substantial contributions of code.

For comments, corrections, bug alerts and suggestions, we thank Monsuru Adepeju, Corey Anderson, Ang Qi Wei, Ryan Arellano, Jens Astrom, Robert Aue, Marcel Austenfeld, Sandro Azaele, Malissa Baddeley, Guy Bayegnak, Colin Beale, Melanie Bell, Thomas Bendtsen, Ricardo Bernhardt, Andrew Bevan, Brad Biggerstaff, Anders Bilgrau, Leanne Bischof, Christophe Biscio, Roger Bivand, Jose M. Blanco Moreno, Florent Bonneu, Jordan Brown, Ian Buller, Julian Burgos, Simon Byers, Ya-Mei Chang, Jianbao Chen, Igor Chernayavsky, Y.C. Chin, Bjarke Christensen, Lucia Cobo Sanchez, Jean-Francois Coeurjolly, Kim Colyvas, Hadrien Commenges, Rochelle Constantine, Robin Corria Ainslie, Richard Cotton, Marcelino de la Cruz, Peter Dalgaard, Mario D'Antuono, Sourav Das, Peter Diggle, Patrick Donnelly, Ian Dryden, Stephen Eglen, Ahmed El-Gabbas, Belarmain Fandohan, Olivier Flores, David Ford, Peter Forbes, Shane Frank, Janet Franklin, Funwi-Gabga Neba, Oscar Garcia, Agnes Gault, Jonas Geldmann, Marc Genton, Shaaban Ghalandarayeshi, Jason Goldstick, Pavel Grabarnik, C. Graf, Ute Hahn, Andrew Hardegen, Martin Bogsted Hansen, Martin Hazelton, Juha Heikkinen, Mandy Hering, Markus Herrmann, Maximilian Hesselbarth, Paul Hewson, Hamidreza Heydarian, Kurt Hornik, Philipp Hunziker, Jack Hywood, Ross Ihaka, Cenk Icos, Aruna Jammalamadaka, Robert John-Chandran, Devin Johnson, Mahdieh Khanmohammadi, Bob Klaver, Lily Kozmian-Ledward, Peter Kovesi, Mike Kuhn, Jeff Laake, Robert Lamb, Frederic Lavancier, Tom Lawrence, Tomas Lazauskas, Jonathan Lee, George Leser, Angela Li, Li Haitao, George Limitsios, Andrew Lister, Nestor Luambua, Ben Madin, Martin Maechler, Kiran Marchikanti, Jeff Marcus, Robert Mark, Peter McCullagh, Monia Mahling, Jorge Mateu Mahiques, Ulf Mehlig, Frederico Mestre, Sebastian Wastl Meyer, Mi Xiangcheng, Lore De Middeleer, Robin Milne, Enrique Miranda, Jesper Moller, Annie Mollie, Ines Moncada, Mehdi Moradi, Virginia Morera Pujol, Erika Mudrak, Gopalan Nair, Nader Najari, Nicoletta Nava, Linda Stougaard Nielsen, Felipe Nunes, Jens Randel Nyengaard, Jens Oehlschlaegel, Thierry Onkelinx, Sean O'Riordan, Evgeni Parilov, Jeff Picka, Nicolas Picard, Tim Pollington, Mike Porter, Sergiy Protsiv, Adrian Raftery, Ben Ramage, Pablo Ramon, Xavier Raynaud, Nicholas Read, Matt Reiter, Ian Renner, Tom Richardson, Brian Ripley, Ted Rosenbaum, Barry Rowlingson, Jason Rudokas, Tyler Rudolph, John Rudge, Christopher Ryan, Farzaneh Safavimanesh, Aila Sarkka, Cody Schank, Katja Schladitz, Sebastian Schutte, Bryan Scott, Olivia Semboli, Francois Semecurbe, Vadim Shcherbakov, Shen Guochun, Shi Peijian, Harold-Jeffrey Ship, Tammy L Silva, Ida-Maria Sintorn, Yong Song, Malte Spiess, Mark Stevenson, Kaspar Stucki, Jan Sulavik, Michael Sumner, P. Surovy, Ben Taylor, Thordis Linda Thorarinsdottir, Leigh Torres, Berwin Turlach, Torben Tvedebrink, Kevin Ummer, Medha Uppala, Andrew van Burgel, Tobias Verbeke, Mikko Vihtakari, Alexendre Villers, Fabrice Vinatier, Maximilian Vogtland, Sasha Voss, Sven Wagner, Hao Wang, H. Wendrock, Jan Wild, Carl G. Witthoft, Selene Wong, Maxime Woringer, Luke Yates, Mike Zamboni and Achim Zeileis.

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

[Package spatstat.random version 2.1-0 Index]