Learn R Programming

dissUtils (version 1.0)

groupwise.density: Searches Subsets for Nearest Neighbor Densities

Description

In order to compare the distributions of different groups within the same multivariate space, calculates the nearest-neighbor densities of each point in the whole data set according to the distribution of each subset.

Usage

groupwise.density(X, groups, method = "euclidean", p.neighbors = 0.01, init.info = NULL)

Arguments

X
a matrix of numeric data
groups
a factor or vector that can be coerced into a factor, specifying which group each row of X belongs to.
method
see diss
p.neighbors
the proportion of each groups neighbors that should be visited. Proportions are necessary when groups have different sizes because otherwise the densities aren't as comparable.
init.info
see diss

Value

an nrow(X) by nlevels(as.factor(groups)) matrix of nearest-neighbor density estimates.