7.2 Data Processing
Data: Sensory Profiles of Sausages
Rows: 64 obs, 8 types of sausages
Columns: 19 attributes + Session (Sausage Type)
Panel: 9 Panelists in total but we had to eliminate 3 Panelists (JUAN, Mine, Raul) that did not rate all products (this is to satisfy the balance-between-groups condition in MFA).
Note: Ratings on 10-point scale
7.2.1 Data Processing:
In the beginning, we have all iterations of ratings from each Panelist as a group of 8 rows. In order to do MFA (at least with the given package), we need to format in way where the ratings data of each Panelist on the set of 8 products make a “cell data table” - here, we store each of these cells in “tab.list”. Note that we have 6 of them because we have 9 - 3 (incomplete Panelists) = 6 Panelists. After that, we concatenate all “cell data tables” to create the “grand.tab”. Also note that each we have 6 Panelists x 20 Attributes = 120 cols. Each denoted as “Attribute.Panelist”.
#use readxl to read from excel files
data <- readxl::read_xlsx("Sausage data.xlsx", sheet = "Database", col_names = TRUE) #don't hard code location,
wk0 <- as.data.frame(data)
#sort before processing
tables <- data %>% group_by(Panelist) %>% nest()
#generate all "cell data table" (ratings from each Panelist)
tab.list <- lapply(tables$data, cbind)
#drop the 3 Panelists that did not rate all 8 products
tab.list[c(3,8,9)] <- NULL
#make tab.list look nicer and easier to process in the next step
reform <- lapply(tab.list, function(x){
rownames(x) <- tab.list[[1]][,1]
x <- x[,-1]})
#make reform look nicer and easier to process in the next step
get.array <- reform %>% unlist %>% as.numeric %>% array(dim = c(nrow(reform[[1]]), ncol(reform[[1]]),length(reform)), dimnames = list(rownames(reform[[1]]), colnames(reform[[1]]), c(1:length(reform))))
#generate the variables for our grand.tab.
#Note that in the grand.tab we have 6 Panelists x 20 Attributes = 120 cols. Each denoted as "Attribute.Panelist"
col4grandtab <- paste0(rep(colnames(reform[[1]]),length(reform)),".",rep(tables[-c(3,8,9),]$Panelist,each = ncol(reform[[1]])))
grand.tab <- matrix(get.array, nrow = NROW(get.array), ncol = NCOL(get.array) * dim(get.array)[[3]], dimnames = list(rownames(reform[[1]]), col4grandtab))
Data Table 1: All Data: The concatenated data table of ratings from all Panelists on the same set of 8 Products. Note that each we have 6 Panelists x 20 Attributes = 120 cols. Each denoted as “Attribute.Panelist”.
Session.XEL | Aroma impact.XEL | Flavor impact.XEL | Salty.XEL | Umami.XEL | Acidic.XEL | Bitter.XEL | Alliaceous.XEL | Animalic savory.XEL | Bloody.XEL | Floury.XEL | Dark meat.XEL | Eggy.XEL | Fatty.XEL | HVP.XEL | Juicy savory.XEL | Rubbery.XEL | Smokey.XEL | Spicy.XEL | White meat.XEL | Session.LALO | Aroma impact.LALO | Flavor impact.LALO | Salty.LALO | Umami.LALO | Acidic.LALO | Bitter.LALO | Alliaceous.LALO | Animalic savory.LALO | Bloody.LALO | Floury.LALO | Dark meat.LALO | Eggy.LALO | Fatty.LALO | HVP.LALO | Juicy savory.LALO | Rubbery.LALO | Smokey.LALO | Spicy.LALO | White meat.LALO | Session.MARTHA | Aroma impact.MARTHA | Flavor impact.MARTHA | Salty.MARTHA | Umami.MARTHA | Acidic.MARTHA | Bitter.MARTHA | Alliaceous.MARTHA | Animalic savory.MARTHA | Bloody.MARTHA | Floury.MARTHA | Dark meat.MARTHA | Eggy.MARTHA | Fatty.MARTHA | HVP.MARTHA | Juicy savory.MARTHA | Rubbery.MARTHA | Smokey.MARTHA | Spicy.MARTHA | White meat.MARTHA | Session.NERI | Aroma impact.NERI | Flavor impact.NERI | Salty.NERI | Umami.NERI | Acidic.NERI | Bitter.NERI | Alliaceous.NERI | Animalic savory.NERI | Bloody.NERI | Floury.NERI | Dark meat.NERI | Eggy.NERI | Fatty.NERI | HVP.NERI | Juicy savory.NERI | Rubbery.NERI | Smokey.NERI | Spicy.NERI | White meat.NERI | Session.DIANA | Aroma impact.DIANA | Flavor impact.DIANA | Salty.DIANA | Umami.DIANA | Acidic.DIANA | Bitter.DIANA | Alliaceous.DIANA | Animalic savory.DIANA | Bloody.DIANA | Floury.DIANA | Dark meat.DIANA | Eggy.DIANA | Fatty.DIANA | HVP.DIANA | Juicy savory.DIANA | Rubbery.DIANA | Smokey.DIANA | Spicy.DIANA | White meat.DIANA | Session.DULCE | Aroma impact.DULCE | Flavor impact.DULCE | Salty.DULCE | Umami.DULCE | Acidic.DULCE | Bitter.DULCE | Alliaceous.DULCE | Animalic savory.DULCE | Bloody.DULCE | Floury.DULCE | Dark meat.DULCE | Eggy.DULCE | Fatty.DULCE | HVP.DULCE | Juicy savory.DULCE | Rubbery.DULCE | Smokey.DULCE | Spicy.DULCE | White meat.DULCE | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Salchicha de Pavo Nutrideli | 1 | 4 | 6.0 | 3 | 4 | 1 | 0 | 2.5 | 2 | 5.0 | 1.5 | 3 | 1 | 2.1 | 2.0 | 4 | 4 | 3.0 | 3 | 5.0 | 1 | 5.0 | 8.0 | 2.5 | 4.0 | 2.0 | 0.0 | 3.0 | 1.0 | 2.0 | 3.0 | 2.2 | 3.0 | 4.0 | 2.0 | 4.0 | 4.0 | 4.5 | 2.0 | 5.0 | 1 | 5.0 | 5.5 | 4 | 5 | 2.0 | 0.0 | 4.0 | 2.0 | 3.0 | 2.0 | 5.2 | 2.0 | 5.1 | 2 | 6.0 | 5 | 4 | 3 | 3.0 | 1 | 6 | 6 | 2.5 | 2.0 | 1.5 | 0.0 | 2.0 | 1.0 | 1.5 | 3 | 4 | 0.0 | 4.0 | 4.5 | 3.0 | 5.2 | 2.0 | 2.0 | 5.0 | 1 | 6.0 | 7.0 | 5.5 | 4.5 | 2.5 | 0.0 | 3.5 | 5.0 | 2.0 | 4 | 4.0 | 2.0 | 5.1 | 2 | 2.5 | 3.0 | 3.5 | 7.0 | 6.0 | 1 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.0 | 3 | 4 | 1 | 0 | 3.0 | 2 | 3.0 | 3.0 | 0 | 2 | 2.0 | 3.0 | 3 | 2 | 3.0 | 3 | 5.0 | 2 | 4.5 | 6.0 | 3.5 | 4.0 | 2.0 | 0.0 | 2.5 | 2.0 | 2.0 | 3.0 | 0.0 | 2.0 | 3.0 | 2.5 | 3.0 | 3.5 | 3.0 | 3.5 | 5.0 | 2 | 7.0 | 6.0 | 4 | 4 | 2.0 | 0.0 | 4.0 | 2.0 | 0.0 | 3.0 | 0.0 | 0.0 | 2.0 | 1 | 3.0 | 4 | 3 | 2 | 4.0 | 2 | 6 | 7 | 3.0 | 4.0 | 2.5 | 0.0 | 3.0 | 2.0 | 1.0 | 2 | 0 | 0.0 | 3.0 | 1.5 | 3.5 | 4.0 | 2.5 | 2.0 | 3.0 | 2 | 7.0 | 7.0 | 5.0 | 4.0 | 3.0 | 0.0 | 3.5 | 4.0 | 0.0 | 6 | 0.0 | 2.0 | 3.5 | 3 | 4.0 | 4.0 | 2.5 | 2.0 | 7.0 | 2 | 7.0 | 6 | 2 | 2 | 1 | 0 | 4.0 | 3.0 | 3.0 | 4.0 | 0.0 | 1.0 | 3.0 | 0 | 3.0 | 3 | 3.5 | 2 | 4.0 |
Data Table 2: Design Matrix:
The package also reequires a design matrix that describe the membership of each of the 120 cols. It shows which Panelist rated that poerticular attribute. The design matrix needs to be a 1 row and shows membership of each column (Panelist).
# design matrix: need to be 1 row and shows membership of each column (Panelist)
design <- rep(tables[-c(3,8,9),]$Panelist,each = ncol(reform[[1]]))
design.matrix <- matrix(design,nrow = 1, ncol = NCOL(get.array) * dim(get.array)[[3]], dimnames = list("Panelist", col4grandtab))
Session.XEL | Aroma impact.XEL | Flavor impact.XEL | Salty.XEL | Umami.XEL | Acidic.XEL | Bitter.XEL | Alliaceous.XEL | Animalic savory.XEL | Bloody.XEL | Floury.XEL | Dark meat.XEL | Eggy.XEL | Fatty.XEL | HVP.XEL | Juicy savory.XEL | Rubbery.XEL | Smokey.XEL | Spicy.XEL | White meat.XEL | Session.LALO | Aroma impact.LALO | Flavor impact.LALO | Salty.LALO | Umami.LALO | Acidic.LALO | Bitter.LALO | Alliaceous.LALO | Animalic savory.LALO | Bloody.LALO | Floury.LALO | Dark meat.LALO | Eggy.LALO | Fatty.LALO | HVP.LALO | Juicy savory.LALO | Rubbery.LALO | Smokey.LALO | Spicy.LALO | White meat.LALO | Session.MARTHA | Aroma impact.MARTHA | Flavor impact.MARTHA | Salty.MARTHA | Umami.MARTHA | Acidic.MARTHA | Bitter.MARTHA | Alliaceous.MARTHA | Animalic savory.MARTHA | Bloody.MARTHA | Floury.MARTHA | Dark meat.MARTHA | Eggy.MARTHA | Fatty.MARTHA | HVP.MARTHA | Juicy savory.MARTHA | Rubbery.MARTHA | Smokey.MARTHA | Spicy.MARTHA | White meat.MARTHA | Session.NERI | Aroma impact.NERI | Flavor impact.NERI | Salty.NERI | Umami.NERI | Acidic.NERI | Bitter.NERI | Alliaceous.NERI | Animalic savory.NERI | Bloody.NERI | Floury.NERI | Dark meat.NERI | Eggy.NERI | Fatty.NERI | HVP.NERI | Juicy savory.NERI | Rubbery.NERI | Smokey.NERI | Spicy.NERI | White meat.NERI | Session.DIANA | Aroma impact.DIANA | Flavor impact.DIANA | Salty.DIANA | Umami.DIANA | Acidic.DIANA | Bitter.DIANA | Alliaceous.DIANA | Animalic savory.DIANA | Bloody.DIANA | Floury.DIANA | Dark meat.DIANA | Eggy.DIANA | Fatty.DIANA | HVP.DIANA | Juicy savory.DIANA | Rubbery.DIANA | Smokey.DIANA | Spicy.DIANA | White meat.DIANA | Session.DULCE | Aroma impact.DULCE | Flavor impact.DULCE | Salty.DULCE | Umami.DULCE | Acidic.DULCE | Bitter.DULCE | Alliaceous.DULCE | Animalic savory.DULCE | Bloody.DULCE | Floury.DULCE | Dark meat.DULCE | Eggy.DULCE | Fatty.DULCE | HVP.DULCE | Juicy savory.DULCE | Rubbery.DULCE | Smokey.DULCE | Spicy.DULCE | White meat.DULCE | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Panelist | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | XEL | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | LALO | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | MARTHA | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | NERI | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DIANA | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE | DULCE |