View source: R/stepArchetypoids.R

stepArchetypoids | R Documentation |

Execute the archetypoid algorithm repeatedly. It is inspired by the `stepArchetypes`

function of the archetypes R package.

stepArchetypoids(numArchoid,nearest="cand_ns",data,ArchObj)

`numArchoid` |
Number of archetypoids. |

`nearest` |
Initial vector of archetypoids for the BUILD phase of the archetypoid algorithm. This initial vector contain the nearest individuals to the archetypes returned by the |

`data` |
Data matrix. Each row corresponds to an observation and each column corresponds to an anthropometric variable. All variables are numeric. |

`ArchObj` |
The list object returned by the |

A list with the following elements:

*cases*: Anthropometric cases (final vector of `numArchoid`

archetypoids).

*rss*: Residual sum of squares corresponding to the final vector of `numArchoid`

archetypoids.

*archet_ini*: Vector of initial archetypoids (*cand_ns*, *cand_alpha* or *cand_beta*).

*alphas*: Alpha coefficients for the optimal vector of archetypoids.

It may be happen that `archetypes`

does not find results for *k* archetypes. In this case, it is not possible to calculate the vector of nearest individuals and consequently, the vector of archetypoids. Therefore, this function will return an error message.

Irene Epifanio and Guillermo Vinue

Vinue, G., Epifanio, I., and Alemany, S., (2015). Archetypoids: a new approach to define representative archetypal data, *Computational Statistics and Data Analysis* **87**, 102–115.

Cutler, A., and Breiman, L., (1994). Archetypal Analysis, *Technometrics* **36**, 338–347.

Epifanio, I., Vinue, G., and Alemany, S., (2013). Archetypal analysis: contributions for estimating boundary cases in multivariate accommodation problem, *Computers & Industrial Engineering* **64**, 757–765.

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

Eugster, M. J. A., (2012). Performance profiles based on archetypal athletes, *International Journal of Performance Analysis in Sport* **12**, 166–187.

`archetypoids`

, `archetypes`

, `stepArchetypes`

#COCKPIT DESIGN PROBLEM: #As a toy example, only the first 25 individuals are used. USAFSurvey_First25 <- USAFSurvey[1:25, ] #Variable selection: variabl_sel <- c(48, 40, 39, 33, 34, 36) #Changing to inches: USAFSurvey_First25_inch <- USAFSurvey_First25[,variabl_sel] / (10 * 2.54) #Data preprocessing: USAFSurvey_preproc <- preprocessing(USAFSurvey_First25_inch, TRUE, 0.95, TRUE) #For reproducing results, seed for randomness: #suppressWarnings(RNGversion("3.5.0")) #set.seed(2010) #Run archetype algorithm repeatedly from 1 to numArch archetypes: #This is a toy example. In other situation, choose numArch=10 and numRep=20. numArch <- 2 ; numRep <- 2 lass <- stepArchetypesRawData(data = USAFSurvey_preproc$data, numArch = 1:numArch, numRep = numRep, verbose = FALSE) #To understand the warning messages, see the vignette of the #archetypes package. #Run archetypoids algorithm repeatedly from 1 to numArch archetypes: #for(numArchoid in 1:numArch){ # temp <- stepArchetypoids(numArchoid,nearest="cand_ns",USAFSurvey_preproc$data,lass) # filename <- paste("res", numArchoid, sep="") # assign(filename,temp) # save(list=c(filename),file=paste(filename, ".RData", sep="")) #} temp <- stepArchetypoids(2,nearest="cand_ns",USAFSurvey_preproc$data,lass)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.