Learn R Programming

spatstat.explore (version 3.5-2)

nnclean: Nearest Neighbour Clutter Removal

Description

Detect features in a 2D or 3D spatial point pattern using nearest neighbour clutter removal.

Usage

nnclean(X, k, ...)

# S3 method for ppp nnclean(X, k, ..., edge.correct = FALSE, wrap = 0.1, convergence = 0.001, plothist = FALSE, verbose = TRUE, maxit = 50)

# S3 method for pp3 nnclean(X, k, ..., convergence = 0.001, plothist = FALSE, verbose = TRUE, maxit = 50)

Arguments

Value

An object of the same kind as X, obtained by attaching marks to the points of X.

The object also has attributes, as described under Details.

Details

Byers and Raftery (1998) developed a technique for recognising features in a spatial point pattern in the presence of random clutter.

For each point in the pattern, the distance to the \(k\)th nearest neighbour is computed. Then the E-M algorithm is used to fit a mixture distribution to the \(k\)th nearest neighbour distances. The mixture components represent the feature and the clutter. The mixture model can be used to classify each point as belong to one or other component.

The function nnclean is generic, with methods for two-dimensional point patterns (class "ppp") and three-dimensional point patterns (class "pp3") currently implemented.

The result is a point pattern (2D or 3D) with two additional columns of marks:

class

A factor, with levels "noise" and "feature", indicating the maximum likelihood classification of each point.

prob

Numeric vector giving the estimated probabilities that each point belongs to a feature.

The object also has extra information stored in attributes: "theta" contains the fitted parameters of the mixture model, "info" contains information about the fitting procedure, and "hist" contains the histogram structure returned from hist.default if plothist = TRUE.

References

Byers, S. and Raftery, A.E. (1998) Nearest-neighbour clutter removal for estimating features in spatial point processes. Journal of the American Statistical Association 93, 577--584.

See Also

nndist, split.ppp, cut.ppp

Examples

Run this code
  # shapley galaxy cluster
  X <- nnclean(shapley, k=17, plothist=TRUE)
  plot(X, which.marks=1, chars=c(".", "+"), cols=1:2,
       main="Shapley data, cluster and noise")
  plot(X, which.marks=2, cols=function(x)hsv(0.2+0.8*(1-x),1,1),
       main="Shapley data, probability of cluster")
  Y <- split(X, un=TRUE)
  plot(Y, chars="+", cex=0.5)
  marks(X) <- marks(X)$prob
  plot(cut(X, breaks=3), chars=c(".", "+", "+"), cols=1:3)

Run the code above in your browser using DataLab