Learn R Programming

spatstat.geom (version 3.7-2)

rjitter: Random Perturbation of a Point Pattern

Description

Applies independent random displacements to each point in a point pattern.

Usage

rjitter(X, ...)

# S3 method for ppp rjitter(X, radius, retry=TRUE, giveup = 10000, trim=FALSE, ..., nsim=1, drop=TRUE, adjust=1)

Arguments

Value

The result of rjitter.ppp is a point pattern (an object of class "ppp") or a list of point patterns.

Each point pattern has attributes "radius"

and (if retry=TRUE) "tries".

Details

The function rjitter is generic, with methods for point patterns (described here) and for some other types of geometrical objects.

Each of the points in the point pattern X is subjected to an independent random displacement. The displacement vectors are uniformly distributed in a circle of radius radius.

If a displaced point lies outside the window, then if retry=FALSE the point will be lost.

However if retry=TRUE, the algorithm will try again: each time a perturbed point lies outside the window, the algorithm will reject the perturbed point and generate another proposed perturbation of the original point, until one lies inside the window, or until giveup unsuccessful attempts have been made. In the latter case, any unresolved points will be included, without any perturbation. The return value will always be a point pattern with the same number of points as X.

If trim=TRUE, then the displacement radius for each data point will be constrained to be less than or equal to the distance from the data point to the window boundary. This ensures that the randomly displaced points will always fall inside the window; no displaced points will be lost and no retrying will be required. However, it implies that a point lying exactly on the boundary will never be perturbed.

If adjust is given, the jittering radius will be multiplied by adjust. This allows the user to specify that the radius should be a multiple of the default radius.

The resulting point pattern has an attribute "radius" giving the value of radius used. If retry=TRUE, the resulting point pattern also has an attribute "tries" reporting the maximum number of trials needed to ensure that all jittered points were inside the window.

See Also

rexplode

Examples

Run this code
   X <- rsyst(owin(), 10, 10)
   Y <- rjitter(X, 0.02)
   plot(Y)
   Z <- rjitter(X)
   U <- rjitter(X, 0.025, trim=TRUE)

Run the code above in your browser using DataLab