#Cockpit design problem:
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)
#Computation of archetypes and archetypoids:
#For reproducing results, seed for randomness:
set.seed(2010)
#Run archetypes algorithm repeatedly from 1 to numArch archetypes:
numArch <- 10 ; nrep <- 20
lass <- stepArchetypesMod(data=preproc$data,k=1:numArch,verbose=FALSE,nrep=nrep)
#Run archetypoids algorithm repeatedly from 1 to numArch archetypes:
for(i in 1:numArch){
temp <- stepArchetypoids(i,TRUE,preproc$data,lass)
filename <- paste("res", i, sep="")
assign(filename,temp)
save(list=c(filename),file=paste(filename, ".RData", sep=""))
}
for(i in 1:numArch){
temp <- stepArchetypoids(i,FALSE,preproc$data,lass)
filename <- paste("res", i, "_which",sep="")
assign(filename,temp)
save(list=c(filename),file=paste(filename, ".RData", sep=""))
}
Run the code above in your browser using DataLab