I am trying to perform a Procrustean multiple factor analysis on my dataset.
The dataset was created using a technique called 'napping' that is used in sensory science. The problem that I have is that one of the plots pmfa
is supposed to produce is not returned by R.
1. Coordinates data frame
The first (dummy) dataframe was created by 3 panelists placing 4 beverage samples on a sheet of paper and recording the X and Y coordinates of the beverage's position on that paper (data1.coord
).
X1<- c(573, 234, 545, 557) # x coordinate for Panelist 1 (P01)
Y1<- c(391, 308, 375, 82) # y coordinate for Panelist 1 (P01)
X2<- c(303, 224, 577, 515) # x coordinate for Panelist 2 (P02)
Y2<- c(83, 369, 204, 156) # y coordinate for Panelist 2 (P02)
X3<- c(519, 328, 530, 87) # x coordinate for Panelist 3 (P03)
Y3<- c(117, 281, 368, 62) # y coordinate for Panelist 3 (P03)
data1.coord <- data.frame(cbind(X1, Y1, X2, Y2, X3, Y3))
rownames(data1.coord) = c("Sample1" ,"Sample2" ,"Sample3" ,"Sample4")
data1.coord
2. Descriptors data frame
Panelists also assigned descriptors (sweet, earthy, bitter, astringent, smokey) to the 4 samples and these were recorded in a separate dataframe (data1.desc
).
sweet <- c(1, 1, 2, 1)
earthy <- c(1, 1, 1, 2)
bitter <- c(1, 0, 0, 0)
astringent <- c(2, 0, 2, 1)
smokey <- c(2, 2, 0, 0)
data1.desc <- data.frame(cbind(sweet, earthy, creamy, vanilla, smokey)) # contingency table with attributes
rownames(data1.desc) = c("Sample1" ,"Sample2" ,"Sample3" ,"Sample4")
data1.desc
3. Analysis
SensoMineR
was used to analyse this data. nappeplot
plots the configuration of the 4 samples on each sheet of paper as they were placed by each of the 3 panelists. This works fine for me.
library(SensoMineR)
nappeplot(data1.coord, lim = c(650,433)) # Plot panelists' maps
But when I try to get R to plot the individual panelist's maps and how they compare to each other, R only returns the maps of the first 2 panelists. I have tried this with different datasets with a different number of panelists, but to no avail. For some reason the plot for the last panelist is never returned. It doesn't matter if the last panelist is number 3,9, or 100. The last plot is just missing.
x11()
res1 <- pmfa(data1.coord, data1.desc)
4. Code from SensoMineR
Documentation + Troubleshooting
I have tried running the sample code given in the SensoMineR
documentation:
data(napping)
x11()
pmfa(napping.don, napping.words)
This also works fine. All panelist's maps are plotted. I have compared their data frame with mine and the structures look identical. The only thing they're not doing that I am, is passing pmfa
to an object (res1
). I have tried without the res1
object and that also does not make a difference to the number of maps returned.
I don't know why the last panelist's map is not plotted. Any help would be greatly appreciated.
I have solved this problem by updating
Now
pmfa(data1.coord, data1.desc)
displays all panelist's maps without an issue.