# rpoispp

##### Generate Poisson Point Pattern

Generate a random point pattern using the (homogeneous or inhomogeneous) Poisson process. Includes CSR (complete spatial randomness).

##### Usage

`rpoispp(lambda, lmax, win, ...)`

##### Arguments

- lambda
- Intensity of the Poisson process.
Either a single positive number, a
`function(x,y, ...)`

, or a pixel image. - lmax
- An upper bound for the value of
`lambda(x,y)`

, if`lambda`

is a function. - win
- Window in which to simulate the pattern.
An object of class
`"owin"`

or something acceptable to`as.owin`

. Ignored if`lambda`

is a pixel image. - ...
- Arguments passed to
`lambda`

if it is a function.

##### Details

If `lambda`

is a single number,
then this algorithm generates a realisation
of the uniform Poisson process (also known as
Complete Spatial Randomness, CSR) inside the window `win`

with
intensity `lambda`

(points per unit area).
If `lambda`

is a function, then this algorithm generates a realisation
of the inhomogeneous Poisson process with intensity function
`lambda(x,y,...)`

at spatial location `(x,y)`

inside the window `win`

.
The function `lambda`

must work correctly with vectors `x`

and `y`

.
The value `lmax`

must be given and must be an upper bound on the
values of `lambda(x,y,...)`

for all locations `(x, y)`

inside the window `win`

.

If `lambda`

is a pixel image object of class `"im"`

(see `im.object`

), this algorithm generates a realisation
of the inhomogeneous Poisson process with intensity equal to the
pixel values of the image. (The value of the intensity function at an
arbitrary location is the pixel value of the nearest pixel.)
The argument `win`

is ignored;
the window of the pixel image is used instead.
To generate an inhomogeneous Poisson process
the algorithm uses ``thinning'': it first generates a uniform
Poisson process of intensity `lmax`

,
then randomly deletes or retains each point, independently of other points,
with retention probability
$p(x,y) = \lambda(x,y)/\mbox{lmax}$.

##### Value

- The simulated point pattern (an object of class
`"ppp"`

).

##### See Also

##### Examples

```
# uniform Poisson process with intensity 100 in the unit square
pp <- rpoispp(100)
# uniform Poisson process with intensity 1 in a 10 x 10 square
pp <- rpoispp(1, win=owin(c(0,10),c(0,10)))
# plots should look similar !
# inhomogeneous Poisson process in unit square
# with intensity lambda(x,y) = 100 * exp(-3*x)
# Intensity is bounded by 100
pp <- rpoispp(function(x,y) {100 * exp(-3*x)}, 100)
# How to tune the coefficient of x
lamb <- function(x,y,a) { 100 * exp( - a * x)}
pp <- rpoispp(lamb, 100, a=3)
# pixel image
Z <- as.im(function(x,y){100 * sqrt(x+y)}, unit.square())
pp <- rpoispp(Z)
```

*Documentation reproduced from package spatstat, version 1.11-7, License: GPL version 2 or newer*