## Multivariate non-parallel archetypoid algorithm for large applications (ADALARA)

### Description

The ADALARA algorithm is based on the CLARA clustering algorithm. This is the non-parallel version of the algorithm. It allows to detect anomalies (outliers). There are two different methods to detect them: the adjusted boxplot (default and most reliable option) and tolerance intervals. If needed, tolerance intervals allow to define a degree of outlierness.

### Usage

```adalara_no_paral(data, seed, N, m, numArchoid, numRep, huge, prob, type_alg = "ada",
compare = FALSE, verbose = TRUE, vect_tol = c(0.95, 0.9, 0.85),
alpha = 0.05, outl_degree = c("outl_strong", "outl_semi_strong",
```

### Arguments

 `data` Data matrix. Each row corresponds to an observation and each column corresponds to a variable. All variables are numeric. The data must have row names so that the algorithm can identify the archetypoids in every sample. `seed` Integer value to set the seed. This ensures reproducibility. `N` Number of samples. `m` Sample size of each sample. `numArchoid` Number of archetypes/archetypoids. `numRep` For each `numArchoid`, run the archetype algorithm `numRep` times. `huge` Penalization added to solve the convex least squares problems. `prob` Probability with values in [0,1]. `type_alg` String. Options are 'ada' for the non-robust adalara algorithm and 'ada_rob' for the robust adalara algorithm. `compare` Boolean argument to compute the robust residual sum of squares if `type_alg = "ada"` and the non-robust if `type_alg = "ada_rob"`. `verbose` Display progress? Default TRUE. `vect_tol` Vector the tolerance values. Default c(0.95, 0.9, 0.85). Needed if `method='toler'`. `alpha` Significance level. Default 0.05. Needed if `method='toler'`. `outl_degree` Type of outlier to identify the degree of outlierness. Default c("outl_strong", "outl_semi_strong", "outl_moderate"). Needed if `method='toler'`. `method` Method to compute the outliers. Options allowed are 'adjbox' for using adjusted boxplots for skewed distributions, and 'toler' for using tolerance intervals. `frame` Boolean value to indicate whether the frame is computed (Mair et al., 2017) or not. The frame is made up of a subset of extreme points, so the archetypoids are only computed on the frame. Low frame densities are obtained when only small portions of the data were extreme. However, high frame densities reduce this speed-up.

### Value

A list with the following elements:

• cases Optimal vector of archetypoids.

• rss Optimal residual sum of squares.

• outliers: Outliers.

### Author(s)

Guillermo Vinue, Irene Epifanio

### References

Eugster, M.J.A. and Leisch, F., From Spider-Man to Hero - Archetypal Analysis in R, 2009. Journal of Statistical Software 30(8), 1-23, https://doi.org/10.18637/jss.v030.i08

Hubert, M. and Vandervieren, E., An adjusted boxplot for skewed distributions, 2008. Computational Statistics and Data Analysis 52(12), 5186-5201, https://doi.org/10.1016/j.csda.2007.11.008

Kaufman, L. and Rousseeuw, P.J., Clustering Large Data Sets, 1986. Pattern Recognition in Practice, 425-437.

Mair, S., Boubekki, A. and Brefeld, U., Frame-based Data Factorizations, 2017. Proceedings of the 34th International Conference on Machine Learning, Sydney, Australia, 1-9.

Moliner, J. and Epifanio, I., Robust multivariate and functional archetypal analysis with application to financial time series analysis, 2019. Physica A: Statistical Mechanics and its Applications 519, 195-208. https://doi.org/10.1016/j.physa.2018.12.036

Vinue, G., Anthropometry: An R Package for Analysis of Anthropometric Data, 2017. Journal of Statistical Software 77(6), 1-39, https://doi.org/10.18637/jss.v077.i06

`do_ada`, `do_ada_robust`, `adalara`

### Examples

```## Not run:
library(Anthropometry)

data(mtcars)
data <- mtcars
n <- nrow(data)

# Arguments for the archetype/archetypoid algorithm:
# Number of archetypoids:
k <- 3
numRep <- 2
huge <- 200

# Size of the random sample of observations:
m <- 10
# Number of samples:
N <- floor(1 + (n - m)/(m - k))
N

prob <- 0.75

preproc <- preprocessing(data, stand = TRUE, percAccomm = 1)
data1 <- as.data.frame(preproc\$data)
numRep, huge, prob, "ada_rob", FALSE, TRUE,
method = "adjbox", frame = FALSE)

# Examine the results: