Calculate Total Within Cluster Variance of 3D points
Source:R/total_within_cluster_variance.R
total_within_cluster_variance.Rd
Calculates Total Within Cluster Variance(TWCV) of 3D points. This function is normally only used indirectly through `validate_get_twcv`.
Arguments
- point_matrix
An n-by-3 numerical matrix where each row corresponds to a single point in 3D space.
- cluster_vector
A numerical vector of cluster assignments, of length n (ie one assignment per point).
TWCV
TWCV is a synr-specific term for a measure that aims to describe spread of points in 3D space while taking into account that points belong to distinct clusters. TWCV is calculated in a multi-step process:
Each cluster's centroid is calculated.
All points' squared distances to their corresponding centroids are calculated.
The point-to-centroid squared distances are summed up.
The sum of squared distances is divided by the total number of points, minus the number of clusters (to account for decreased degrees of freedom).