Clean
rm(list = ls()); graphics.off()
Set R packages path and load packages
.libPaths("C:/Rpack")
library(openxlsx)
library(FactoMineR)
library(SensoMineR)
Load source
source("rectangle.R")
Import data
napping <- read.xlsx("PMdata.xlsx", sheet = 1, rowNames = T)
Show napping
nS <- ncol(napping)/2
for (s in 1:nS) {
# s = 1
windows(60,40)
rectangle(napping,s)
# savePlot(file = paste0("Napping - Subject ", s), type = "tif")
}
Apply MFA
res.napping <- MFA(napping,group=rep(2,11),type=rep("c",11),name.group=paste("S",1:11,sep=""),graph=F)
Plot MFA results
Individual plot
windows(10,10)
plot.MFA(res.napping,choix="ind",habillage="none",
graph.type = "classic")

Group representation
plot.MFA(res.napping, choix = "group", habillage = "none",
col.hab = c(rep("black",11)),
graph.type = "classic")

RV coefficients
res.napping$group$RV
## S1 S2 S3 S4 S5 S6 S7
## S1 1.00000000 0.4000407 0.62510428 0.07814363 0.52122157 0.09537330 0.44597630
## S2 0.40004065 1.0000000 0.20128544 0.16221212 0.21805739 0.15592010 0.33396734
## S3 0.62510428 0.2012854 1.00000000 0.04024969 0.49807348 0.13680329 0.06752412
## S4 0.07814363 0.1622121 0.04024969 1.00000000 0.31630656 0.34090818 0.54447861
## S5 0.52122157 0.2180574 0.49807348 0.31630656 1.00000000 0.08098975 0.36083418
## S6 0.09537330 0.1559201 0.13680329 0.34090818 0.08098975 1.00000000 0.16575681
## S7 0.44597630 0.3339673 0.06752412 0.54447861 0.36083418 0.16575681 1.00000000
## S8 0.44475424 0.6443297 0.43968885 0.16766065 0.18213093 0.13749923 0.30591874
## S9 0.63429497 0.1746508 0.41925436 0.23031284 0.58497864 0.06908720 0.46522157
## S10 0.10783423 0.1995181 0.01302569 0.70893899 0.32754496 0.18147893 0.50113377
## S11 0.73052315 0.3666179 0.47811713 0.03513154 0.32147954 0.06276951 0.12583832
## MFA 0.77106388 0.5830620 0.59554123 0.53915777 0.66358462 0.36422499 0.64669112
## S8 S9 S10 S11 MFA
## S1 0.4447542 0.6342950 0.10783423 0.73052315 0.7710639
## S2 0.6443297 0.1746508 0.19951809 0.36661788 0.5830620
## S3 0.4396888 0.4192544 0.01302569 0.47811713 0.5955412
## S4 0.1676606 0.2303128 0.70893899 0.03513154 0.5391578
## S5 0.1821309 0.5849786 0.32754496 0.32147954 0.6635846
## S6 0.1374992 0.0690872 0.18147893 0.06276951 0.3642250
## S7 0.3059187 0.4652216 0.50113377 0.12583832 0.6466911
## S8 1.0000000 0.3356965 0.25153686 0.33275390 0.6444639
## S9 0.3356965 1.0000000 0.20924806 0.46381452 0.6947955
## S10 0.2515369 0.2092481 1.00000000 0.03372882 0.5254009
## S11 0.3327539 0.4638145 0.03372882 1.00000000 0.6011400
## MFA 0.6444639 0.6947955 0.52540094 0.60114001 1.0000000