Calculates the atypicality index (ranges between 0 and 1, 1 being more atypical/different) for all the observations of a composition or compares one sample to the given composition, using Compositional Data Analysis (CoDA) principles.
CoDA_Atyp_Idx(comp, sample = NULL, thres = 0.95)
comp | A matrix or data frame of observations for a given composition. Entries must be non-zero and positive. |
---|---|
sample | A one sample vector to compare against the given composition. |
thres | Threshold to classify observation as atypical, from 0 to 1 (Default is 0.95) |
A matrix with the atypicality index or indices.
Aitchison, J. (1986). The statistical analysis of compositional data. Chapman and Hall.
data("Hongite", package = 'compositions') samp = c(44, 20.4, 13.9, 9.1, 12.6) CoDA_Atyp_Idx(Hongite)#>#> # A tibble: 25 × 2 #> idx Atypical #> <dbl> <chr> #> 1 0.712 No #> 2 0.0171 No #> 3 0.199 No #> 4 0.0318 No #> 5 0.709 No #> 6 0.828 No #> 7 0.882 No #> 8 0.969 Yes #> 9 0.1 No #> 10 0.987 Yes #> # … with 15 more rowsCoDA_Atyp_Idx(Hongite, samp)#>#> # A tibble: 1 × 2 #> idx Atypical #> <dbl> <chr> #> 1 0.998 Yes