Randomly Shift a Point Pattern
Randomly shifts the points of a point pattern.
## S3 method for class 'ppp': rshift(X, \dots, radius, width, height, edge="torus", clip, group, which)
- Point pattern to be subjected to a random shift.
An object of class
- Optional parameters controlling the generation of the random shift vector. See Details.
- String indicating how to deal with edges of the pattern.
"none". See Details.
- Optional. Factor specifying a grouping of the points of
NULLindicating that all points belong to the same group. Each group will be shifted together, and separately from other groups. By default, points in
- Optional. Identifies which groups of the pattern will be shifted,
while other groups are not shifted. A vector of levels of
- Optional. Window to which the final point pattern should be clipped.
This operation randomly shifts the locations of the points in a point pattern.
rshift is generic. This function
is the method for point patterns.
The most common use of this function is to shift the points in a multitype point pattern. By default, points of the same type are shifted in parallel (i.e. points of a common type are shifted by a common displacement vector), and independently of other types. This is useful for testing the hypothesis of independence of types (the null hypothesis that the sub-patterns of points of each type are independent point processes).
In general the points of
X are divided into groups,
then the points within a group are shifted by a common
random displacement vector. Different groups of points are shifted
independently. The grouping is determined as follows:
- If the argument
groupis present, then this determines the grouping.
- Otherwise, if
Xis a multitype point pattern, the marks determine the grouping.
- Otherwise, all points belong to a single group.
groupshould be a factor, of length equal to the number of points in
NULL, which specifies that all points of
Xbelong to a single group.
By default, every group of points will be shifted.
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
(for example, a vector of types in a multitype pattern)
indicating which groups are to be shifted.
The displacement vector, i.e. the vector by which the data points are shifted, is generated at random. If the window is a rectangle, 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
[object Object],[object Object]
edge controls what happens when
a shifted point lies outside the window of
[object Object],[object Object],[object Object]
The optional argument
clip specifies a smaller window
to which the pattern should be restricted.
- A point pattern (object of class
## S3 method for class 'ppp': rshift(X, \dots, which=NULL, group)
data(amacrine) # random toroidal shift # shift "on" and "off" points separately X <- rshift(amacrine) # shift "on" points and leave "off" points fixed X <- rshift(amacrine, which="on") # shift all points simultaneously X <- rshift(amacrine, group=NULL) # maximum displacement distance 0.1 units X <- rshift(amacrine, radius=0.1) # shift with erosion X <- rshift(amacrine, radius=0.1, edge="erode")