rthin {spatstat}R Documentation

Random Thinning

Description

Applies independent random thinning to a point pattern.

Usage

rthin(X, P, ...)

Arguments

X A point pattern (object of class "ppp") that will be thinned.
P Data giving the retention probabilities, i.e. the probability that each point in X will be retained. Either a single number, or a vector of numbers, or a function(x,y), or a pixel image (object of class "im").
... Additional arguments passed to P, if it is a function.

Details

In a random thinning operation, each point of the pattern X is randomly either deleted or retained (i.e. not deleted). The result is a point pattern, consisting of those points of X that were retained.

Independent random thinning means that the retention/deletion of each point is independent of other points.

The argument P determines the probability of retaining each point. It may be

a single number,
so that each point will be retained with the same probability P;
a vector of numbers,
so that the ith point of X will be retained with probability P[i];
a function P(x,y),
so that a point at a location (x,y) will be retained with probability P(x,y);
a pixel image,
containing values of the retention probability for all locations in a region encompassing the point pattern.

If P is a function, it should be ‘vectorised’, that is, it should accept vector arguments x,y and should yield a numeric vector of the same length. The function may have extra arguments which are passed through the ... argument.

Value

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

Author(s)

Adrian Baddeley adrian@maths.uwa.edu.au http://www.maths.uwa.edu.au/~adrian/ and Rolf Turner rolf@math.unb.ca http://www.math.unb.ca/~rolf

References

Examples

  data(redwood)
  plot(redwood, main="thinning")
  
  # delete 20% of points
  Y <- rthin(redwood, 0.8)
  points(Y, col="green", cex=1.4)

  # function
  f <- function(x,y) { ifelse(x < 0.4, 1, 0.5) }
  Y <- rthin(redwood, f)

  # pixel image
  Z <- as.im(f, redwood$window)
  Y <- rthin(redwood, Z)

[Package spatstat version 1.11-3 Index]