estimateDc {densityClust} | R Documentation |
This function calculates a distance cutoff value for a specific distance matrix that makes the average neighbor rate (number of points within the distance cutoff value) fall between the provided range. The authors of the algorithm suggests aiming for a neighbor rate between 1 and 2 percent, but also states that the algorithm is quite robust with regards to more extreme cases.
estimateDc(distance, neighborRateLow = 0.01, neighborRateHigh = 0.02)
distance |
A distance matrix |
neighborRateLow |
The lower bound of the neighbor rate |
neighborRateHigh |
The upper bound of the neighbor rate |
A numeric value giving the estimated distance cutoff value
If the number of points is larger than 448 (resulting in 100,128
pairwise distances), 100,128 distance pairs will be randomly selected to
speed up computation time. Use set.seed()
prior to calling
estimateDc
in order to ensure reproducable results.
Rodriguez, A., & Laio, A. (2014). Clustering by fast search and find of density peaks. Science, 344(6191), 1492-1496. doi:10.1126/science.1242072
irisDist <- dist(iris[,1:4])
estimateDc(irisDist)