Learn R Programming

spatstat (version 1.52-1)

rSSI: Simulate Simple Sequential Inhibition

Description

Generate a random point pattern, a realisation of the Simple Sequential Inhibition (SSI) process.

Usage

rSSI(r, n=Inf, win = square(1), giveup = 1000, x.init=NULL, ...,
      f=NULL, fmax=NULL, nsim=1, drop=TRUE)

Arguments

r

Inhibition distance.

n

Maximum number of points allowed. If n is finite, stop when the total number of points in the point pattern reaches n. If n is infinite (the default), stop only when it is apparently impossible to add any more points. See Details.

win

Window in which to simulate the pattern. An object of class "owin" or something acceptable to as.owin. The default window is the unit square, unless x.init is specified, when the default window is the window of x.init.

giveup

Number of rejected proposals after which the algorithm should terminate.

x.init

Optional. Initial configuration of points. A point pattern (object of class "ppp"). The pattern returned by rSSI consists of this pattern together with the points added via simple sequential inhibition. See Details.

Ignored.

f,fmax

Optional arguments passed to rpoint to specify a non-uniform probability density for the random points.

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.

Value

A point pattern (an object of class "ppp") if nsim=1, or a list of point patterns if nsim > 1.

Details

This algorithm generates one or more realisations of the Simple Sequential Inhibition point process inside the window win.

Starting with an empty window (or with the point pattern x.init if specified), the algorithm adds points one-by-one. Each new point is generated uniformly in the window and independently of preceding points. If the new point lies closer than r units from an existing point, then it is rejected and another random point is generated. The algorithm terminates when either

(a)

the desired number n of points is reached, or

(b)

the current point configuration has not changed for giveup iterations, suggesting that it is no longer possible to add new points.

If n is infinite (the default) then the algorithm terminates only when (b) occurs. The result is sometimes called a Random Sequential Packing.

Note that argument n specifies the maximum permitted total number of points in the pattern returned by rSSI(). If x.init is not NULL then the number of points that are added is at most n - npoints(x.init) if n is finite.

Thus if x.init is not NULL then argument n must be at least as large as npoints(x.init), otherwise an error is given. If n==npoints(x.init) then a warning is given and the call to rSSI() has no real effect; x.init is returned.

There is no requirement that the points of x.init be at a distance at least r from each other. All of the added points will be at a distance at least r from each other and from any point of x.init.

The points will be generated inside the window win and the result will be a point pattern in the same window.

The default window is the unit square, win = square(1), unless x.init is specified, when the default is win=Window(x.init), the window of x.init.

If both win and x.init are specified, and if the two windows are different, then a warning will be issued. Any points of x.init lying outside win will be removed, with a warning.

See Also

rpoispp, rMaternI, rMaternII.

Examples

Run this code
# NOT RUN {
 Vinf <- rSSI(0.07)

 V100 <- rSSI(0.07, 100)

 X <- runifpoint(100)
 Y <- rSSI(0.03,142,x.init=X) # Y consists of X together with
                              # 42 added points.
 plot(Y, main="rSSI")
 plot(X,add=TRUE,chars=20,cols="red")

 ## inhomogeneous
 Z <- rSSI(0.07, 50, f=function(x,y){x})
 plot(Z)
# }

Run the code above in your browser using DataLab