#Cockpit design problem:
m <- dataUSAF
sel <- c(48,40,39,33,34,36)
mpulg <- m[,sel] / (10 * 2.54)
#Data preprocessing:
preproc <- accommodation(mpulg,TRUE,0.95,TRUE)
#For reproducing results, seed for randomness:
set.seed(2010)
#Run archetype algorithm repeatedly from 1 to numArch archetypes:
numArch <- 10 ; nrep <- 20
lass <- stepArchetypesMod(data=preproc$data,k=1:numArch,verbose=FALSE,nrep=nrep)
#Three archetypoids:
i <- 3
res <- archetypoids(i,preproc$data,huge=200,step=FALSE,ArchObj=lass,nearest=TRUE,sequ=TRUE)
aux <- res$archet
percs <- list()
for(j in 1:length(aux)){
percs[[j]] <- sapply(1:dim(preproc$data)[2],compPerc,aux[j],preproc$data,0)
}
m <- matrix(unlist(percs),nrow=6,ncol=length(percs),byrow=F)
barplot(m,beside=TRUE,main=paste(i," archetypoids (from nearest)",sep = ""),
ylim=c(0,100),ylab="Percentile")
Run the code above in your browser using DataLab