spatstat (version 1.43-0)

rshift.psp: Randomly Shift a Line Segment Pattern

Description

Randomly shifts the segments in a line segment pattern.

Usage

## S3 method for class 'psp':
rshift(X, \dots, group=NULL, which=NULL)

Arguments

X
Line segment pattern to be subjected to a random shift. An object of class "psp".
...
Arguments controlling the randomisation and the handling of edge effects. See rshift.ppp.
group
Optional. Factor specifying a grouping of the line segments of X, or NULL indicating that all line segments belong to the same group. Each group will be shifted together, and separately from other groups.
which
Optional. Identifies which groups of the pattern will be shifted, while other groups are not shifted. A vector of levels of group.

Value

  • A line segment pattern (object of class "psp").

Details

This operation randomly shifts the locations of the line segments in a line segment pattern.

The function rshift is generic. This function rshift.psp is the method for line segment patterns.

The line segments of X are first divided into groups, then the line segments within a group are shifted by a common random displacement vector. Different groups of line segments are shifted independently. If the argument group is present, then this determines the grouping. Otherwise, all line segments belong to a single group.

The argument group should be a factor, of length equal to the number of line segments in X. Alternatively group may be NULL, which specifies that all line segments of X belong to a single group.

By default, every group of line segments will be shifted. The argument which indicates that only some of the groups should be shifted, while other groups should be left unchanged. which must be a vector of levels of group indicating which groups are to be shifted.

The displacement vector, i.e. the vector by which the data line segments are shifted, is generated at random. The default behaviour is to generate a displacement vector at random with equal probability for all possible displacements. This means that the $x$ and $y$ coordinates of the displacement vector are independent random variables, uniformly distributed over the range of possible coordinates.

Alternatively, the displacement vector can be generated by another random mechanism, controlled by the arguments radius, width and height. [object Object],[object Object]

The argument edge controls what happens when a shifted line segment lies partially or completely outside the window of X. Currently the only option is "erode" which specifies that the segments will be clipped to a smaller window.

The optional argument clip specifies a smaller window to which the pattern should be restricted.

See Also

rshift, rshift.ppp

Examples

Run this code
X <- psp(runif(20), runif(20), runif(20), runif(20),  window=owin())
  Y <- rshift(X, radius=0.1)

Run the code above in your browser using DataCamp Workspace