Learn R Programming

adamethods (version 1.2.1)

do_ada: Run the whole classical archetypoid analysis with the Frobenius norm

Description

This function executes the entire procedure involved in the archetypoid analysis. Firstly, the initial vector of archetypoids is obtained using the archetypal algorithm and finally, the optimal vector of archetypoids is returned.

Usage

do_ada(subset, numArchoid, numRep, huge, compare = FALSE,
              vect_tol = c(0.95, 0.9, 0.85), alpha = 0.05, 
              outl_degree = c("outl_strong", "outl_semi_strong", "outl_moderate"),
              method = "adjbox", prob)

Arguments

subset

Data to obtain archetypes. In ADALARA this is a subset of the entire data frame.

numArchoid

Number of archetypes/archetypoids.

numRep

For each numArch, run the archetype algorithm numRep times.

huge

Penalization added to solve the convex least squares problems.

compare

Boolean argument to compute the robust residual sum of squares to compare these results with the ones provided by do_ada_robust.

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.

prob

If compare=TRUE, probability with values in [0,1].

Value

A list with the following elements:

  • cases: Final vector of archetypoids.

  • alphas: Alpha coefficients for the final vector of archetypoids.

  • rss: Residual sum of squares corresponding to the final vector of archetypoids.

  • rss_rob: If compare=TRUE, this is the residual sum of squares using the robust Frobenius norm. Otherwise, NULL.

  • resid: Vector with the residuals.

  • outliers: Outliers.

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

Vinue, G., Epifanio, I., and Alemany, S., Archetypoids: a new approach to define representative archetypal data, 2015. Computational Statistics and Data Analysis 87, 102-115, https://doi.org/10.1016/j.csda.2015.01.018

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

See Also

stepArchetypesRawData_norm_frob, archetypoids_norm_frob

Examples

Run this code
# NOT RUN {
library(Anthropometry)
data(mtcars)
#data <- as.matrix(mtcars)
data <- mtcars

k <- 3
numRep <- 2
huge <- 200

preproc <- preprocessing(data, stand = TRUE, percAccomm = 1)
suppressWarnings(RNGversion("3.5.0"))
set.seed(2018)
res_ada <- do_ada(preproc$data, k, numRep, huge, FALSE, method = "adjbox")
str(res_ada)     

res_ada1 <- do_ada(preproc$data, k, numRep, huge, FALSE, 
                   vect_tol = c(0.95, 0.9, 0.85), alpha = 0.05, 
                   outl_degree = c("outl_strong", "outl_semi_strong", 
                                   "outl_moderate"), method = "toler")
str(res_ada1) 

res_ada2 <- do_ada(preproc$data, k, numRep, huge, TRUE, method = "adjbox", prob = 0.8)
str(res_ada2) 
                 
# }

Run the code above in your browser using DataLab