View source: R/robust_ggower.R
| robust_ggower | R Documentation |
Computes a weighted, robust version of the Gower distance for mixed-type data (continuous, binary, categorical). Continuous variables are handled via a robust Mahalanobis distance using a supplied robust covariance matrix. Binary and categorical variables are transformed into distances via similarity coefficients.
robust_ggower(data, w, p, robust_cov)
data |
Numeric matrix or data frame with all variables combined. |
w |
Numeric vector of weights for each observation. Will be normalized internally. |
p |
Integer vector of length 3: |
robust_cov |
Robust covariance matrix for continuous variables. |
The function computes distances separately for continuous, binary, and categorical variables, then scales each by its geometric variability and combines them. The output is a normalized squared distance matrix suitable for robust clustering or aggregation procedures.
Continuous distances are Mahalanobis distances: (x-y)^T (S)^-1 (x-y).
Categorical distances use a matching coefficient.
Binary distances are modified to account for positive/negative matches.
A numeric matrix of squared robust Gower distances, normalized by geometric variability.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.