nnclean(X, k, ...)
## S3 method for class 'ppp':
nnclean(X, k, ..., probs = FALSE,
edge.correct = FALSE, wrap = 0.1,
convergence = 0.001, plothist = FALSE,
verbose = TRUE, maxit = 50)
## S3 method for class 'pp3':
nnclean(X, k, ...,
convergence = 0.001, plothist = FALSE,
verbose = TRUE, maxit = 50)
"ppp"
) or a three-dimensional point pattern
(object of class "pp3"
).k=1
means nearest neighbour,
k=2
means second nearest, etc.edge.correct=TRUE
).
A fraction of window width and window height.X
,
obtained by attaching marks to the points of X
. If probs=FALSE
(the default), the marks are a factor
with levels "noise"
and "feature"
indicating the
maximum likelihood classification of each point by the algorithm.
If probs=TRUE
, the marks are numeric,
giving the estimated probabilities
that each point belongs to a feature.
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 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.
For two-dimensional point patterns,
probs=FALSE
, the result is a
binary classification. Each point is classified by maximum likelihood
as belonging either to the feature or the clutter.
The return value is a marked point pattern, where the marks are a factor
with levels"noise"
and"feature"
indicating the
classification of each point. Ifprobs=TRUE
, the result is a fuzzy or probabilistic
classification. The return value is a marked point pattern
with marks giving the estimated probabilities
that each point belongs to a feature.
For three-dimensional point patterns, the result is a 3D point pattern with two (additional) columns of marks, one containing the probabilities, and one containing the binary classification.
nndist
,
split.ppp
,
cut.ppp
data(shapley)
X <- nnclean(shapley, k=17)
plot(X, chars=c(".", "+"), cols=1:2)
Y <- split(X)
plot(Y, chars="+", cex=0.5)
Z <- nnclean(shapley, k=17, probs=TRUE)
plot(cut(Z, breaks=3), chars=c(".", "+", "+"), cols=1:3)
Run the code above in your browser using DataLab