data(houmousr)
fac1 <- houmousr$faccc
df1 <- houmousr$dfcc
nf1 <- nlevels(fac1) - 1
# Compute PCA
pca1 <- dudi.pca(df1, scale = FALSE, scannf = FALSE, nf = nf1)
# Compute BGA
bca1 <- bca(pca1, fac1, scannf = FALSE, nf = nf1)
if(adegraphicsLoaded()) {
s.class(bca1$ls, fac1, starSize = 0, chullSize = 1, ellipseSize = 0, ppoint.cex = 0,
plabel.cex = 0, plegend.drawKey = FALSE, col = TRUE)
s.class(bca1$ls, fac1, starSize = 1, ellipseSize = 0, col = TRUE, add = T)
} else {
col1 <- c("#E41A1C", "#377EB8", "#4DAF4A", "#984EA3", "#FF7F00")
s.class(bca1$ls, fac1, cstar = 1, cellipse = 0, col = col1)
s.chull(bca1$ls, fac1, optchull = 1, add.plot = TRUE, col = col1)
}
if (FALSE) {
# Compute cross-validated coordinates
xbca1 <- loocv(bca1)
plot(xbca1)}
Run the code above in your browser using DataLab