#TRIMOWA ALGORITHM:
dataTrimowa <- sampleSpanishSurvey
numVar <- dim(dataTrimowa)[2]
bust <- dataTrimowa$bust
bustSizes <- bustSizesStandard(seq(74, 102, 4), seq(107, 131, 6))
orness <- 0.7
weightsTrimowa <- weightsMixtureUB(orness,numVar)
numClust <- 3 ; alpha <- 0.01 ; niter <- 10 ; algSteps <- 7
ah <- c(23, 28, 20, 25, 25)
set.seed(2014)
res_trimowa <- list()
for (i in 1 : (bustSizes$nsizes - 1)){
data = dataTrimowa[(bust >= bustSizes$bustCirc[i]) & (bust < bustSizes$bustCirc[i + 1]), ]
res_trimowa[[i]] <- trimowa(data, weightsTrimowa, numClust, alpha, niter,
algSteps,ah,verbose=FALSE)
}
prototypes <- anthrCases("anthropometry", "trimowa", res_trimowa, oneSize = FALSE, bustSizes$nsizes)
bustVariable <- "bust"
xlim <- c(70, 150)
color <- c("black", "red", "green", "blue", "cyan", "brown", "gray",
"deeppink3", "orange", "springgreen4", "khaki3", "steelblue1")
variable <- "chest"
range(dataTrimowa[,variable])
#[1] 76.7755 135.8580
ylim <- c(70,140)
title <- "Prototypes \n bust vs chest"
plotPrototypes(dataTrimowa, prototypes, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, FALSE)
plotPrototypes(dataTrimowa, prototypes, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, TRUE)
variable <- "hip"
range(dataTrimowa[,variable])
#[1] 83.6 152.1
ylim <- c(80,160)
title <- "Prototypes \n bust vs hip"
plotPrototypes(dataTrimowa, prototypes, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, FALSE)
plotPrototypes(dataTrimowa, prototypes, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, TRUE)
bustVariable <- "bust"
xlim <- c(70, 150)
color <- c("black", "red", "green", "blue", "cyan", "brown", "gray",
"deeppink3", "orange", "springgreen4", "khaki3", "steelblue1")
variable <- "necktoground"
range(dataTrimowa[,variable])
#[1] 117.6 154.9
ylim <- c(110, 160)
title <- "Prototypes \n bust vs neck to ground"
plotPrototypes(dataTrimowa, prototypes, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, FALSE)
plotPrototypes(dataTrimowa, prototypes, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, TRUE)
variable <- "waist"
range(dataTrimowa[,variable])
#[1] 58.6 133.0
ylim <- c(50,140)
title <- "Prototypes \n bust vs waist"
plotPrototypes(dataTrimowa, prototypes, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, FALSE)
plotPrototypes(dataTrimowa, prototypes, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, TRUE)
#AN EXAMPLE FOR HIPAM ALGORITHM:
dataHipam <- sampleSpanishSurvey
bust <- dataHipam$bust
bustSizes <- bustSizesStandard(seq(74, 102, 4), seq(107, 131, 6))
type <- "IMO" #type <- "MO" for $HIPAM_{MO}$
maxsplit <- 5 ; orness <- 0.7
ah <- c(23, 28, 20, 25, 25)
set.seed(2013)
res_hipam <- list()
for(i in 1 : (bustSizes$nsizes - 1)){
data = dataHipam[(bust >= bustSizes$bustCirc[i]) & (bust < bustSizes$bustCirc[i + 1]), ]
dataMat <- as.matrix(data)
res_hipam[[i]] <- hipamAnthropom(dataMat, maxsplit = maxsplit, orness = orness, type = type,
ah = ah, verbose = FALSE)
}
str(res_hipam)
fitmodels <- anthrCases("anthropometry", "HipamAnthropom", res_hipam,
oneSize = FALSE, bustSizes$nsizes)
bustVariable <- "bust"
xlim <- c(70, 150)
color <- c("black", "red", "green", "blue", "cyan", "brown", "gray",
"deeppink3", "orange", "springgreen4", "khaki3", "steelblue1")
variable <- "hip"
ylim <- c(80, 160)
title <- "Fit models HIPAM_IMO \n bust vs hip"
plotPrototypes(dataHipam, fitmodels, bustSizes$nsizes, bustVariable,
variable, color, xlim, ylim, title, FALSE)
Run the code above in your browser using DataLab