pairDist {quickcode} | R Documentation |
Calculate the distance of points from the center of a cluster
Description
This function operates on multivariate data and calculates the distance of points from the centroid of one or more clusters.
Usage
pairDist(data, round)
Arguments
data |
data frame object or a matrix/array object |
round |
round result to decimal place |
Value
a named vector consisting of a row number and a pair-distance value
Function utility
Used to generate the computations needed to model pair-distance measures in three dimensions
More information about this function
The pairDist function is used to quantify how far each data point (row) is from the overall mean across all columns. It’s commonly used in multivariate statistics, machine learning, and data analysis to assess the variability or similarity of data points relative to their mean. More specifically, the function is used in outlier detection and cluster analysis to evaluate the dispersion of data. Used in conjunction with other calculations, pairDist output can also be used to model data in three dimensions.
References
the current function was adapted from one of the examples in the svgViewR package,
https://cran.r-project.org/web/packages/svgViewR/svgViewR.pdf
Examples
data = attenu[,1:2]
#basic example using data.frame
pairDist(data)
#basic example using as.matrix
pairDist(as.matrix(data))
# round results to 2 decimal points
pairDist(data, 2)