Learn R Programming

Anthropometry (version 1.1)

indivNearest: Nearest individuals to archetypes

Description

The nearest individual to each archetype can be obtained by simply computing the distance between the archetypes and the individuals and choosing the nearest. This is the procedure to obtain what is called the nearest vector, see Vinue et al. (2013). It is used within archetypoids and stepArchetypoids.

Usage

indivNearest(Indivs,NumArchet,mdras)

Arguments

Indivs
Vector from 1 to NumArchet.
NumArchet
Number of archetypes computed.
mdras
Distance matrix between the archetypes and the individuals.

Value

  • A vector with the nearest individuals to archetypes.

References

Vinue, G., Epifanio, I., and Alemany, S., (2014). Archetypoids: a new approach to define representative archetypal data. Submitted for publication.

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.

See Also

archetypoids, stepArchetypoids, archetypesBoundary

Examples

Run this code
#First,the USAF 1967 database is read and preprocessed (Zehner et al. (1993)).
m <- dataUSAF
#Variable selection:
sel <- c(48,40,39,33,34,36)
#Changing to inches: 
mpulg <- m[,sel] / (10 * 2.54)

#Data preprocessing:
preproc <- accommodation(mpulg,TRUE,0.95,TRUE) 

#Procedure and results shown in section 2.2.2 and section 3.1 of Epifanio et al. (2013):
res <- archetypesBoundary(preproc$data,15,FALSE,3)

i=3
a3 <- archetypes::bestModel(res[[i]])
ras <- rbind(archetypes::parameters(a3),preproc$data)
dras <- dist(ras,method="euclidean",diag=F,upper=T,p=2)
mdras <- as.matrix(dras)
diag(mdras) <- 1e+11
sapply(1:i,indivNearest,i,mdras)

Run the code above in your browser using DataLab