Learn R Programming

spatstat.geom (version 3.8-2)

rjitter.pp3: Random Perturbation of a 3D Point Pattern

Description

Applies independent random displacements to each point in a three-dimensional point pattern.

Usage

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

Value

The result of rjitter.pp3 is a three-dimensional point pattern (an object of class "pp3") or a list of 3D point patterns.

Each point pattern has attributes "radius"

and (if retry=TRUE) "tries".

Arguments

X

A point pattern (object of class "ppp").

radius

Scale of perturbations. A positive numerical value. The displacement vectors will be uniformly distributed inside a sphere of this radius. There is a sensible default. Alternatively, radius may be a numeric vector of length equal to the number of points in X, giving a different displacement radius for each data point.

retry

What to do when a perturbed point lies outside the window of the original point pattern. If retry=FALSE, the point will be lost; if retry=TRUE, the algorithm will try again.

giveup

Maximum number of unsuccessful attempts.

trim

Logical value. If TRUE, 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 all displaced points will fall inside the window.

...

Ignored.

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.

adjust

Adjustment factor applied to the radius. A numeric value or numeric vector.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

Details

The function rjitter is generic, with methods for point patterns and for some other types of geometrical objects. This help page describes the method for three-dimensional point patterns of class "pp3".

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

If a displaced point lies outside the domain of the pattern, 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 domain, the algorithm will reject the perturbed point and generate another proposed perturbation of the original point, until one lies inside the domain, 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 domain boundary. This ensures that the randomly displaced points will always fall inside the domain; 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 domain.

See Also

rjitter

Examples

Run this code
   X <- osteo$pts[[1]]
   Y <- rjitter(X, 5)
   plot(Y)
   Z <- rjitter(X)
   U <- rjitter(X, 5, trim=TRUE)

Run the code above in your browser using DataLab