### Install SensoMineR from GitHub Source: https://github.com/husson/sensominer/blob/master/README.md Uses the devtools package to install the latest development version of SensoMineR directly from the GitHub repository. ```r if (!require("devtools")) install.packages("devtools") library(devtools) install_github("husson/SensoMineR") ``` -------------------------------- ### Run FASNT analysis on smoothies data Source: https://github.com/husson/sensominer/blob/master/man/fasnt.rd This example demonstrates how to use the fasnt function with the 'nappe' option for napping variables and specifies a semicolon as the word separator. Ensure the 'smoothies' dataset is loaded before running this code. ```R data(smoothies) ## Example of FASNT results res.fasnt<-fasnt(smoothies,first="nappe",sep.word=";") ``` -------------------------------- ### boot - Bootstrap Confidence Ellipses Source: https://context7.com/husson/sensominer/llms.txt Simulates virtual panels using bootstrap for sorting task, napping, and free choice profiling data to generate confidence ellipses. ```APIDOC ## boot - Bootstrap Confidence Ellipses ### Description Simulates virtual panels using bootstrap for sorting task, napping, and free choice profiling data to generate confidence ellipses. ### Method Not specified (R function) ### Endpoint Not applicable (R function) ### Parameters - **data** (data.frame) - Input data (e.g., napping, perfume, smoothies, cards, perfume_fcp). - **method** (character) - The method to use ('napping', 'sorting', 'sortnapping', 'hsort', 'freechoice'). - **nbsim** (numeric) - Number of bootstrap simulations. - **level.conf** (numeric) - Confidence level for ellipses. - **group** (numeric vector, optional) - Grouping information for certain methods (e.g., 'hsort', 'freechoice'). ### Request Example ```r # Napping data data(napping) res <- boot(napping.don, method = "napping", nbsim = 200, level.conf = 0.95) # Sorting task data data(perfume) res <- boot(perfume, method = "sorting") # Sorted napping data data(smoothies) res <- boot(smoothies, method = "sortnapping") # Hierarchical sorting task data(cards) group.cards <- c(2,3,3,2,2,4,2,3,2,1,3,2,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3) res <- boot(cards, method = "hsort", group = group.cards) # Free choice profiling data(perfume_fcp) res <- boot(perfume_fcp, method = "freechoice", group = c(12,7,7,7,6,8)) # Plot ellipses using the simulation results plotellipse(res$simul, alpha = 0.05, eig = res$eig) ``` ### Response - **simul** (list) - Simulation results used for plotting ellipses. - **eig** (list) - Eigenvalues from PCA (used with `plotellipse`). ``` -------------------------------- ### fast - Factorial Approach for Sorting Task Source: https://context7.com/husson/sensominer/llms.txt Analyzes sorting task data where products are categorized by consumers, optionally with verbal descriptions (qualified sorting). ```APIDOC ## fast - Factorial Approach for Sorting Task ### Description Analyzes sorting task data where products are categorized by consumers, optionally with verbal descriptions (qualified sorting). ### Method `fast` ### Endpoint N/A (Function within a library) ### Parameters - **data** (data) - The sorting task data. - **sep.words** (string, optional) - Separator for words in qualified sorting. Defaults to ";". - **alpha** (numeric, optional) - Significance level for tests. Defaults to 0.05. - **ncp** (numeric, optional) - Number of components to retain. Defaults to 5. - **B** (numeric, optional) - Number of bootstrap samples. Defaults to 200. ### Request Example ```R data(perfume) # Perform FAST analysis with qualified sorting res.fast <- fast(perfume, sep.words = ";", alpha = 0.05, ncp = 5, B = 200) ``` ### Response - **eig** (matrix) - Eigenvalues and variance explained. - **ind$coord** (matrix) - Product coordinates. - **var$coord** (matrix) - Category coordinates. - **group$coord** (matrix) - Consumer contributions. - **cooccur** (matrix) - Co-occurrence matrix (how often products are grouped together). - **cramer** (matrix) - Cramer's V matrix between consumers. - **textual** (list) - Textual analysis results. ### Response Example ```R # Example of eigenvalues # res.fast$eig = matrix(c(10.5, 5.2, ...), ncol=2, dimnames=list(1:2, c("eigenvalue", "variance"))) # Example of product coordinates # res.fast$ind$coord = matrix(c(1.1, -0.5, -0.2, 0.8, ...), ncol=2) ``` ``` -------------------------------- ### IdMap - Ideal Mapping Source: https://context7.com/husson/sensominer/llms.txt Creates ideal maps based on consumer ideal profiles, showing where consumers' ideals are positioned relative to existing products. ```APIDOC ## IdMap - Ideal Mapping ### Description Creates ideal maps based on consumer ideal profiles, showing where consumers' ideals are positioned relative to existing products. ### Method Not specified (R function) ### Endpoint Not applicable (R function) ### Parameters - **perfume_ideal** (data.frame) - Input data containing product and consumer liking information. - **col.p** (numeric) - Column index for product information. - **col.j** (numeric) - Column index for consumer information. - **col.lik** (numeric) - Column index for liking information. - **id.recogn** (character) - Pattern to identify ideal variables. - **nbsimul** (numeric) - Number of bootstrap simulations. - **alpha** (numeric) - Confidence level for confidence intervals. - **precision** (numeric) - Precision of the grid for plotting. - **cons.eq** (logical) - If TRUE, uses equal weight for all consumers (for wIdMap). ### Request Example ```r data(perfume_ideal) # Create Ideal Map res.IdMap <- IdMap(perfume_ideal, col.p = 2, # Product column col.j = 1, # Consumer column col.lik = ncol(perfume_ideal), # Liking column id.recogn = "id_", # Pattern to identify ideal variables nbsimul = 500, # Bootstrap simulations alpha = 0.05, # Confidence level precision = 0.1) # Grid precision # Plot the ideal map plot.IdMap(res.IdMap, xlim = c(-7,10), ylim = c(-5,7), levels.contour = NULL, color = TRUE) # Weighted Ideal Map (wIdMap) - equal weight for all consumers res.wIdMap <- IdMap(perfume_ideal, col.p = 2, col.j = 1, col.lik = ncol(perfume_ideal), id.recogn = "id_", cons.eq = TRUE) ``` ### Response - **PCA** (list) - PCA results for sensory space. - **idmap** (list) - Contains ideal map data and weights. - **data** (data.frame) - Ideal map data. - **j.weight** (numeric) - Consumer weights. - **ideal** (data.frame) - Estimated ideal profile. ``` -------------------------------- ### Visualize product positioning with panellipse Source: https://context7.com/husson/sensominer/llms.txt Generates confidence ellipses around products using bootstrap techniques to visualize statistical uncertainty. ```r data(chocolates) # PCA-based confidence ellipses res <- panellipse(sensochoc, col.p = 4, col.j = 1, firstvar = 5, alpha = 0.05, nbsimul = 300) # Results include eigenvalues and variance explained res$eig # Product coordinates res$coordinates$moyen # Hotelling's T2 test P-values for product pair comparisons coltable(res$hotelling, main.title = "P-values for the Hotelling's T2 tests") ``` -------------------------------- ### Perform Just About Right (JAR) Analysis Source: https://context7.com/husson/sensominer/llms.txt Conducts penalty analysis on JAR scale data to identify attributes impacting consumer liking. Requires specifying the JAR data, column indices for products, judges, preference, and the JAR level. Outputs include one-dimensional and multi-dimensional penalty results, frequency of non-JAR responses, and plotting capabilities. ```r data(JAR) res.jar <- JAR(JAR, col.p = 13, col.j = 1, col.pref = 2, jarlevel = "jar") res.jar$penalty1 # Penalty Std.Dev P-value # Sweet_Not enough -1.23 0.34 0.0012 # Sweet_Too much -0.89 0.28 0.0234 # Salty_Not enough -0.45 0.21 0.1234 # ... res.jar$penalty2 res.jar$Frequency # Product1 Product2 Product3 # Sweet_Not enough 25% 15% 30% # Sweet_Too much 10% 20% 5% # ... plot(res.jar, name.prod = "284", model = 1) ``` -------------------------------- ### JAR - Just About Right Analysis Source: https://context7.com/husson/sensominer/llms.txt Performs penalty analysis on JAR (Just About Right) scale data to identify attributes that impact consumer liking. ```APIDOC ## JAR - Just About Right Analysis ### Description Performs penalty analysis on JAR (Just About Right) scale data to identify attributes that impact consumer liking. ### Method `JAR` ### Endpoint N/A (Function within a library) ### Parameters - **JAR_data** (data) - The JAR scale data. - **col.p** (numeric) - Column index for product information. - **col.j** (numeric) - Column index for JAR level information. - **col.pref** (numeric) - Column index for preference data. - **jarlevel** (string, optional) - The level considered as 'Just About Right'. Defaults to "jar". ### Request Example ```R data(JAR) # Perform JAR analysis res.jar <- JAR(JAR, col.p = 13, col.j = 1, col.pref = 2, jarlevel = "jar") ``` ### Response - **penalty1** (matrix) - One-dimensional penalty results (descriptor by descriptor). - **penalty2** (matrix) - Multi-dimensional penalty results (all descriptors simultaneously). - **Frequency** (matrix) - Frequency of non-JAR responses by product. ### Response Example ```R # Example of penalty1 results # res.jar$penalty1 = matrix(c(-1.23, -0.89, -0.45, ...), ncol=3, dimnames=list(c("Sweet_Not enough", "Sweet_Too much", ...), c("Penalty", "Std.Dev", "P-value"))) # Example of Frequency results # res.jar$Frequency = matrix(c("25%", "10%", "15%", ...), nrow=2, dimnames=list(c("Sweet_Not enough", "Sweet_Too much"), c("Product1", "Product2"))) ``` ``` -------------------------------- ### Visualize Matrices with coltable Source: https://context7.com/husson/sensominer/llms.txt Display a matrix with cells colored based on significance thresholds for visual interpretation. ```r data(chocolates) resdecat <- decat(sensochoc, formul = "~Product+Panelist", firstvar = 5, graph = FALSE) # Color cells based on significance thresholds coltable(resdecat$tabT, level.lower = -1.96, col.lower = "mistyrose", # Below -1.96 in light red level.upper = 1.96, col.upper = "lightblue", # Above 1.96 in light blue level.lower2 = -2.58, col.lower2 = "red", # Below -2.58 in red level.upper2 = 2.58, col.upper2 = "blue", # Above 2.58 in blue main.title = "Products' description") ``` -------------------------------- ### Perform Factorial Approach for Sorting Task (FAST) Source: https://context7.com/husson/sensominer/llms.txt Analyzes sorting task data, including qualified sorting with textual descriptions. Requires specifying the input data, word separator, significance level, number of components, and bootstrap iterations. Outputs include eigenvalues, coordinates, and co-occurrence matrices. ```r data(perfume) res.fast <- fast(perfume, sep.words = ";", alpha = 0.05, ncp = 5, B = 200) res.fast$eig res.fast$ind$coord res.fast$var$coord res.fast$group$coord res.fast$cooccur res.fast$cramer res.fast$textual res.consensual <- ConsensualWords(res.fast, nbtimes = 3, nbsimul = 500, proba = 0.05) res.consensual$Consensual.words ``` -------------------------------- ### Visualize hierarchical sorting with hsortplot Source: https://github.com/husson/sensominer/blob/master/man/hsortplot.rd Generates graphs representing the hierarchical sorting provided by each consumer. Requires a data frame of product partitions and a list specifying the number of levels per consumer. ```R data(cards) group.cards<-c(2,3,3,2,2,4,2,3,2,1,3,2,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3) hsortplot(cards,group.cards) ``` -------------------------------- ### Create and Plot Ideal Map Source: https://context7.com/husson/sensominer/llms.txt Generates an ideal map based on consumer ideal profiles and product data. Requires specifying columns for products, consumers, and liking, along with a pattern for ideal variables. Bootstrap simulations are used for confidence levels. ```r data(perfume_ideal) # Create Ideal Map res.IdMap <- IdMap(perfume_ideal, col.p = 2, # Product column col.j = 1, # Consumer column col.lik = ncol(perfume_ideal), # Liking column id.recogn = "id_", # Pattern to identify ideal variables nbsimul = 500, # Bootstrap simulations alpha = 0.05, # Confidence level precision = 0.1) # Grid precision # Plot the ideal map plot.IdMap(res.IdMap, xlim = c(-7,10), ylim = c(-5,7), levels.contour = NULL, color = TRUE) ``` -------------------------------- ### Print FAHST Results to File Source: https://github.com/husson/sensominer/blob/master/man/print.fahst.rd Prints FAHST results to a specified file with a custom separator. Ensure the file path is valid and the 'fahst' object is correctly generated. ```R data(cards) group<-c(2,3,3,2,2,4,2,3,2,1,3,2,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3) res.fast <- fahst(cards,group,graph=F) print.fahst(res.fast, file="c:/fahst.csv", sep = ";") ``` -------------------------------- ### cpa - Consumers' Preferences Analysis Source: https://context7.com/husson/sensominer/llms.txt Performs preference mapping oriented towards consumers, picturing consumers according to their preferences and clustering them based on hedonic patterns. ```APIDOC ## cpa - Consumers' Preferences Analysis ### Description Performs preference mapping oriented towards consumers, picturing consumers according to their preferences and clustering them based on hedonic patterns. ### Method `cpa` ### Endpoint N/A (Function within a library) ### Parameters - **data** (matrix) - Combined data matrix (e.g., composition and sensory data). - **hedo** (data) - Hedonic data (consumer preferences). - **center** (logical, optional) - Whether to center the data. Defaults to TRUE. - **scale** (logical, optional) - Whether to scale the data. Defaults to TRUE. - **nb.clusters** (numeric, optional) - Number of clusters. 0 for automatic detection. Defaults to 0. - **col** (vector, optional) - Color vector for plotting. ### Request Example ```R # Analyze consumer preferences res.cpa <- cpa(cbind(compo.cocktail, senso.cocktail), hedo.cocktail, center = TRUE, scale = TRUE, nb.clusters = 0) # With specified number of clusters and grayscale res.cpa <- cpa(cbind(compo.cocktail, senso.cocktail), hedo.cocktail, col = gray((50:1)/50), nb.clusters = 3) ``` ### Response - **clusters** (vector) - Cluster assignments for each consumer. - **result** (matrix) - Coordinates of panelists, clusters, and archetypes. - **prod.clusters** (list) - Products characteristic of each cluster. - **desc.clusters** (list) - Correlation with sensory descriptors. ### Response Example ```R # Example of cluster assignments # res.cpa$clusters = c(1, 2, 1, 3, 2, ...) # Example of archetype coordinates # res.cpa$result[1:3, ] = matrix(c(1.2, -0.5, 0.8, 2.1, 1.0, -1.5, ...), nrow=3) ``` ``` -------------------------------- ### panellipse - Confidence Ellipses Around Products Source: https://context7.com/husson/sensominer/llms.txt Generates confidence ellipses around products using bootstrap techniques on virtual panels to visualize statistical uncertainty in product positioning. ```APIDOC ## panellipse ### Description Generates confidence ellipses around products using bootstrap techniques on virtual panels to visualize statistical uncertainty in product positioning. ### Parameters - **sensochoc** (data.frame) - Required - The sensory data set. - **col.p** (integer) - Required - The column index for the product identifier. - **col.j** (integer) - Required - The column index for the panelist identifier. - **firstvar** (integer) - Required - The index of the first sensory descriptor column. - **alpha** (numeric) - Optional - The significance level for the ellipses. - **nbsimul** (integer) - Optional - Number of bootstrap simulations. ### Response - **eig** (numeric) - Eigenvalues and variance explained. - **coordinates** (list) - Product coordinates. - **hotelling** (matrix) - Hotelling's T2 test P-values for product pair comparisons. ``` -------------------------------- ### Analyze Consumer Preferences with CPA Source: https://context7.com/husson/sensominer/llms.txt Performs Consumers' Preferences Analysis (CPA) to map consumers based on their preferences and cluster them. Can handle combined sensory and composition data, with options for centering, scaling, and specifying the number of clusters. Requires hedonic data. ```r data(cocktail) res.cpa <- cpa(cbind(compo.cocktail, senso.cocktail), hedo.cocktail, center = TRUE, scale = TRUE, nb.clusters = 0) res.cpa$clusters res.cpa$result res.cpa$prod.clusters res.cpa$desc.clusters res.cpa <- cpa(cbind(compo.cocktail, senso.cocktail), hedo.cocktail, col = gray((50:1)/50), nb.clusters = 3) ``` -------------------------------- ### Generate Optimal Experimental Designs Source: https://context7.com/husson/sensominer/llms.txt Construct experimental designs balanced for first-order carry-over effects. ```r # Design for 10 panelists evaluating 5 products, 3 per panelist design <- optimaldesign(nbPanelist = 10, nbProd = 5, nbProdByPanelist = 3) # Product assignment per panelist design$design # How many times each product appears at each rank design$rank # How many times each product follows each other product design$succ ``` -------------------------------- ### Perform Preference Mapping with Carto Source: https://context7.com/husson/sensominer/llms.txt Generates preference maps using PCA or MFA results on sensory data, combined with hedonic data. Allows for specifying regression model type, response surface levels, map resolution, and cluster detection. Requires the FactoMineR library. ```r library(FactoMineR) data(cocktail) res.pca <- PCA(senso.cocktail) res.carto <- carto(res.pca$ind$coord[,1:2], hedo.cocktail, regmod = 1, # 1=quadratic, 2=vector, 3=circular, 4=elliptical level = 0, # Standard deviations for response surface resolution = 200, # Map resolution nb.clusters = 0, # 0 = automatic cluster detection graph.carto = TRUE) res.mfa <- MFA(cbind.data.frame(senso.cocktail, compo.cocktail), group = c(ncol(senso.cocktail), ncol(compo.cocktail)), name.group = c("senso", "compo")) res.carto <- carto(res.mfa$ind$coord[,1:2], hedo.cocktail) ``` -------------------------------- ### averagetable - Compute Products x Descriptors Matrix Source: https://context7.com/husson/sensominer/llms.txt Computes the product-by-descriptor matrix with entries as means or adjusted means over panelists and sessions. ```APIDOC ## averagetable - Compute Products x Descriptors Matrix ### Description Returns the product-by-descriptor matrix with entries as means or adjusted means over panelists and sessions. ### Method `averagetable` ### Endpoint N/A (Function within a library) ### Parameters - **sensochoc** (data) - The input sensory data. - **formul** (formula) - The ANOVA model formula (e.g., `~Product+Panelist`). - **firstvar** (numeric) - The index of the first descriptor variable. - **method** (string, optional) - The method for calculation, defaults to adjusted means. Use 'mean' for simple means. ### Request Example ```R # Compute adjusted means using ANOVA model resaverage <- averagetable(sensochoc, formul = "~Product+Panelist", firstvar = 5) # Simple means (no ANOVA adjustment) resaverage_simple <- averagetable(sensochoc, formul = "~Product", firstvar = 5, method = "mean") ``` ### Response - **average_table** (matrix) - The computed product-by-descriptor matrix. ### Response Example ```R # Example structure of the returned matrix # Descriptor1 Descriptor2 ... # Product1 4.5 3.2 # Product2 3.8 4.1 # ... ``` ``` -------------------------------- ### carto - Preference Mapping Source: https://context7.com/husson/sensominer/llms.txt Performs preference mapping techniques based on multidimensional exploratory data analysis to identify optimal product characteristics based on consumer preferences. ```APIDOC ## carto - Preference Mapping ### Description Performs preference mapping techniques based on multidimensional exploratory data analysis to identify optimal product characteristics based on consumer preferences. ### Method `carto` ### Endpoint N/A (Function within a library) ### Parameters - **ind.coord** (matrix) - The coordinates of individuals (e.g., from PCA or MFA). - **hedo** (data) - Hedonic data (consumer preferences). - **regmod** (numeric, optional) - Regression model type (1=quadratic, 2=vector, 3=circular, 4=elliptical). Defaults to 1. - **level** (numeric, optional) - Standard deviations for response surface. Defaults to 0. - **resolution** (numeric, optional) - Map resolution. Defaults to 200. - **nb.clusters** (numeric, optional) - Number of clusters. 0 for automatic detection. Defaults to 0. - **graph.carto** (logical, optional) - Whether to display the carto graph. Defaults to TRUE. ### Request Example ```R # Assuming res.pca is the result of a PCA analysis on sensory data # and hedo.cocktail contains hedonic data res.carto <- carto(res.pca$ind$coord[,1:2], hedo.cocktail, regmod = 1, level = 0, resolution = 200, nb.clusters = 0, graph.carto = TRUE) # With MFA combining sensory and composition data res.mfa <- MFA(cbind.data.frame(senso.cocktail, compo.cocktail), group = c(ncol(senso.cocktail), ncol(compo.cocktail)), name.group = c("senso", "compo")) res.carto <- carto(res.mfa$ind$coord[,1:2], hedo.cocktail) ``` ### Response - **carto_results** (list) - Results of the preference mapping, including graphical output if `graph.carto` is TRUE. ### Response Example N/A (Output is typically a graphical plot and a list of results) ``` -------------------------------- ### Sort Matrices with magicsort Source: https://context7.com/husson/sensominer/llms.txt Sort rows and columns of a matrix optimally for visualization using PCA or statistical measures. ```r data(chocolates) resdecat <- decat(sensochoc, formul = "~Product", firstvar = 5, graph = FALSE) # Magic sort (based on PCA) coltable(magicsort(resdecat$tabT), level.lower = -1.96, level.upper = 1.96) # Sort by median res.sort <- magicsort(resdecat$tabT, method = "median") # Sort by mean, descending res.sort <- magicsort(resdecat$tabT, method = "mean", ascending = FALSE) ``` -------------------------------- ### Perform Free Choice Profiling (FCP) Analysis Source: https://context7.com/husson/sensominer/llms.txt Analyzes Free Choice Profiling data using MFA and bootstrap ellipses. Requires the FCP data, group sizes for variables per panelist, and options for scaling and component estimation. ```r data(perfume_fcp) # Perform FCP analysis with MFA and bootstrap ellipses res <- fcp(perfume_fcp, group = c(12, 7, 7, 7, 6, 8), # Variables per panelist scale = TRUE, # Scale variables ncp = NULL, # Auto-estimate components nbsim = 500, # Bootstrap simulations level.conf = 0.95, # Confidence level graph = c("ind", "var", "ellipse")) ``` -------------------------------- ### Identify Discriminating Descriptors Source: https://context7.com/husson/sensominer/llms.txt Select descriptors that significantly discriminate between products based on P-value thresholds. ```r data(chocolates) # Find descriptors with P-value < 0.5 interesting.desc <- search.desc(sensochoc, col.j = 1, col.p = 4, firstvar = 5, level = 0.5) # Use result for further analysis res <- panellipse(interesting.desc, col.p = 4, col.j = 1, firstvar = 5) ``` -------------------------------- ### Perform Procrustean Multiple Factor Analysis (PMFA) Source: https://context7.com/husson/sensominer/llms.txt Performs PMFA on napping data, superimposing individual configurations onto a consensus configuration. Requires napping data and associated words, with options for dilatation and visualization. ```r data(napping) # Visualize raw napping data nappeplot(napping.don) # Perform PMFA result <- pmfa(napping.don, napping.words, dilat = TRUE, # Use Morand's dilatation graph.ind = TRUE, # Show individual configurations graph.mfa = TRUE, # Show MFA graphs lim = c(60, 40), # Tablecloth dimensions coord = c(1, 2)) ``` -------------------------------- ### Analyze sensory descriptors with decat Source: https://context7.com/husson/sensominer/llms.txt Performs ANOVA to identify significant sensory descriptors. Requires a formula specifying product and panelist effects. ```r library(SensoMineR) data(chocolates) # Perform ANOVA analysis: descriptor = product + panelist resdecat <- decat(sensochoc, formul = "~Product+Panelist", firstvar = 5, proba = 0.05) # Access results # F-test results with V-test and P-values for each descriptor resdecat$tabF # V-test P-value # CocoaA 4.23 0.0012 # Milk 3.89 0.0034 # ... # T-test results: V-test values for each product-descriptor combination resdecat$tabT # CocoaA Milk Sweet Vanilla # choc1 2.45 -1.23 0.89 1.56 # choc2 -1.89 2.34 -0.45 -1.23 # ... # Adjusted means for each product-descriptor combination resdecat$adjmean # Visualize results with barplot barrow(resdecat$tabT) barrow(resdecat$coeff, color = "orange") ``` -------------------------------- ### Fit INDSCAL Model for Napping Data Source: https://context7.com/husson/sensominer/llms.txt Applies the INDSCAL model to napping data to analyze individual differences in product perception. Requires the napping data and associated words, with options for maximum iterations and convergence epsilon. ```r data(napping) # Visualize napping data nappeplot(napping.don) # Fit INDSCAL model resindscal <- indscal(napping.don, napping.words, maxit = 200, eps = 1/10^5) ``` -------------------------------- ### Create Williams Latin Square Design Source: https://context7.com/husson/sensominer/llms.txt Generate a balanced Williams Latin Square design for sensory experiments. ```r # Create Williams design for 6 products design <- WilliamsDesign(6) ``` -------------------------------- ### Bootstrap Confidence Ellipses for Sorting Task Data Source: https://context7.com/husson/sensominer/llms.txt Generates bootstrap confidence ellipses for sorting task data. Requires the product data and method set to 'sorting'. ```r # Sorting task data data(perfume) res <- boot(perfume, method = "sorting") ``` -------------------------------- ### Bootstrap Confidence Ellipses for Napping Data Source: https://context7.com/husson/sensominer/llms.txt Generates bootstrap confidence ellipses for napping data by simulating virtual panels. Requires the napping data, method set to 'napping', and number of simulations. ```r # Napping data data(napping) res <- boot(napping.don, method = "napping", nbsim = 200, level.conf = 0.95) ``` -------------------------------- ### Plot FAHST data for levels with trajectories Source: https://github.com/husson/sensominer/blob/master/man/plot.fahst.rd Plots the levels of FAHST data and draws trajectories between levels of the same consumer if 'traj=TRUE'. ```R plot.fahst(res.fahst,choix="level",traj=TRUE) ``` -------------------------------- ### Compute Average Product-Descriptor Matrix Source: https://context7.com/husson/sensominer/llms.txt Calculates the product-by-descriptor matrix using mean or adjusted means over panelists and sessions. Can be used with ANOVA adjustment or simple means. Requires specifying the input data, formula, and the first variable. ```r data(chocolates) resaverage <- averagetable(sensochoc, formul = "~Product+Panelist", firstvar = 5) coltable(magicsort(resaverage), level.upper = 6, level.lower = 4, main.title = "Average by chocolate") library(FactoMineR) res.pca <- PCA(resaverage, scale.unit = TRUE) resaverage_simple <- averagetable(sensochoc, formul = "~Product", firstvar = 5, method = "mean") ``` -------------------------------- ### Triangle Test with Preference Data Source: https://context7.com/husson/sensominer/llms.txt Extends the triangle test analysis to include preference data. This allows for determining not only discrimination but also which product is preferred among those that can be discriminated. ```r # With preference data preference <- c("X","X","Y","Y","Z","X","Y","X","Z", "X","X","Z","X","Y","X","Z","X","Y") result <- triangle.test(design, answer, preference) result$preference # Preference counts ``` -------------------------------- ### Weighted Ideal Map (wIdMap) Source: https://context7.com/husson/sensominer/llms.txt Creates a weighted ideal map where all consumers are given equal weight. This variant of IdMap is useful for understanding product positioning without consumer-specific weighting. ```r # Weighted Ideal Map (wIdMap) - equal weight for all consumers res.wIdMap <- IdMap(perfume_ideal, col.p = 2, col.j = 1, col.lik = ncol(perfume_ideal), id.recogn = "id_", cons.eq = TRUE) ``` -------------------------------- ### fcp - Free Choice Profiling Source: https://context7.com/husson/sensominer/llms.txt Analyzes free choice profiling data where each panelist uses their own set of descriptors to evaluate products. ```APIDOC ## fcp - Free Choice Profiling ### Description Analyzes free choice profiling data where each panelist uses their own set of descriptors to evaluate products. ### Method Not specified (R function) ### Endpoint Not applicable (R function) ### Parameters - **perfume_fcp** (data.frame) - Free choice profiling data. - **group** (numeric vector) - Number of variables per panelist. - **scale** (logical) - If TRUE, scale variables. - **ncp** (numeric, optional) - Number of components to estimate. If NULL, it's auto-estimated. - **nbsim** (numeric) - Number of bootstrap simulations. - **level.conf** (numeric) - Confidence level for bootstrap ellipses. - **graph** (character vector) - Types of graphs to generate ('ind', 'var', 'ellipse'). ### Request Example ```r data(perfume_fcp) # Perform FCP analysis with MFA and bootstrap ellipses res <- fcp(perfume_fcp, group = c(12, 7, 7, 7, 6, 8), # Variables per panelist scale = TRUE, # Scale variables ncp = NULL, # Auto-estimate components nbsim = 500, # Bootstrap simulations level.conf = 0.95, # Confidence level graph = c("ind", "var", "ellipse")) ``` ### Response - **mfa** (list) - Results from the Multiple Factor Analysis. - **boot** (list) - Bootstrap results for ellipse plotting. ``` -------------------------------- ### Perform FAHST Analysis Source: https://github.com/husson/sensominer/blob/master/man/fahst.rd Executes the Factorial Approach for Hierarchical Sorting Task on the cards dataset. ```R data(cards) ## Example of FAHST results group.cards<-c(2,3,3,2,2,4,2,3,2,1,3,2,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3) res.fahst<-fahst(cards,group=group.cards) ``` -------------------------------- ### Correlation Coefficient Confidence Intervals Source: https://context7.com/husson/sensominer/llms.txt Provides methods to calculate and access the lower and upper bounds of correlation coefficient confidence intervals. ```APIDOC ## Correlation Coefficient Confidence Intervals ### Description Calculates and provides access to the lower and upper bounds of correlation coefficient confidence intervals. ### Method N/A (Accessing pre-computed results) ### Endpoint N/A (Typically accessed after running a correlation analysis) ### Parameters N/A ### Request Example ```R # Assuming 'res' is the result object from a correlation analysis res$correl$min # Lower bounds res$correl$max # Upper bounds ``` ### Response N/A (Direct access to computed values) ### Response Example ```R # Example values for lower and upper bounds # res$correl$min = 0.75 # res$correl$max = 0.92 ``` ``` -------------------------------- ### Identify Consensual Words with FAST Source: https://github.com/husson/sensominer/blob/master/man/ConsensualWords.rd Use this function after running the 'fast' analysis to find words that are consensually used by consumers. Ensure 'res.fast' is an object of class 'fast'. ```R data(perfume) ## Example of FAST results res.fast<-fast(perfume,sep.words=";") res.consensual<-ConsensualWords(res.fast) ``` -------------------------------- ### Bootstrap Confidence Ellipses for Free Choice Profiling Source: https://context7.com/husson/sensominer/llms.txt Generates bootstrap confidence ellipses for Free Choice Profiling data. Requires the FCP data, method set to 'freechoice', and a vector defining the number of variables per panelist. ```r # Free choice profiling data(perfume_fcp) res <- boot(perfume_fcp, method = "freechoice", group = c(12,7,7,7,6,8)) ``` -------------------------------- ### decat - Description of Categories Source: https://context7.com/husson/sensominer/llms.txt Performs analysis of variance to identify which sensory descriptors significantly discriminate between products. ```APIDOC ## decat ### Description Performs analysis of variance to identify which sensory descriptors significantly discriminate between products. This function tests the main effect of a categorical variable (F-test) and the significance of its coefficients (T-test) for a set of endogenous variables. ### Parameters - **sensochoc** (data.frame) - Required - The sensory data set. - **formul** (string) - Required - The formula for the ANOVA model (e.g., "~Product+Panelist"). - **firstvar** (integer) - Required - The index of the first sensory descriptor column. - **proba** (numeric) - Optional - The significance threshold for the F-test. ### Response - **tabF** (list) - F-test results with V-test and P-values for each descriptor. - **tabT** (list) - T-test results: V-test values for each product-descriptor combination. - **adjmean** (list) - Adjusted means for each product-descriptor combination. ``` -------------------------------- ### Assess panel performance with panelperf Source: https://context7.com/husson/sensominer/llms.txt Computes P-values and residual terms to evaluate the discrimination capability of a sensory panel. ```r data(chocolates) # Analyze panel performance with full model res <- panelperf(sensochoc, firstvar = 5, formul = "~Product+Panelist+Session+Product:Panelist+Session:Product+Panelist:Session") # Results include: # P-values for each descriptor and factor res$p.value # Product Panelist Session Product:Panelist # CocoaA 0.0012 0.0234 0.4521 0.1234 # Milk 0.0034 0.0156 0.3421 0.0987 # ... # Percentage of variability explained by each factor res$variability # Residual terms res$res # R-squared values res$r2 # Display sorted results with colored table coltable(magicsort(res$p.value, sort.mat = res$p.value[,1], bycol = FALSE, method = "median"), main.title = "Panel performance (sorted by product P-value)") ``` -------------------------------- ### indscal - INDSCAL Model for Napping Source: https://context7.com/husson/sensominer/llms.txt Applies the INDSCAL (Individual Differences Scaling) model to napping data for analyzing individual differences in product perception. ```APIDOC ## indscal - INDSCAL Model for Napping ### Description Applies the INDSCAL (Individual Differences Scaling) model to napping data for analyzing individual differences in product perception. ### Method Not specified (R function) ### Endpoint Not applicable (R function) ### Parameters - **napping.don** (data.frame) - Napping data. - **napping.words** (data.frame) - Words associated with napping data. - **maxit** (numeric) - Maximum number of iterations. - **eps** (numeric) - Convergence threshold. ### Request Example ```r data(napping) # Visualize napping data nappeplot(napping.don) # Fit INDSCAL model resindscal <- indscal(napping.don, napping.words, maxit = 200, eps = 1/10^5) ``` ### Response - **resindscal** (list) - The fitted INDSCAL model object. ``` -------------------------------- ### Bootstrap Confidence Ellipses for Sorted Napping Data Source: https://context7.com/husson/sensominer/llms.txt Generates bootstrap confidence ellipses for sorted napping data. Requires the sorted data and method set to 'sortnapping'. ```r # Sorted napping data data(smoothies) res <- boot(smoothies, method = "sortnapping") ``` -------------------------------- ### print.fahst Source: https://github.com/husson/sensominer/blob/master/man/print.fahst.rd Prints the results of a Factorial Approach for Hierarchical Sorting Task (FAHST) object. ```APIDOC ## print.fahst ### Description Prints the results of a Factorial Approach for Hierarchical Sorting Task (FAHST) object. ### Method S3 Method ### Parameters #### Arguments - **x** (fahst object) - Required - An object of class fahst. - **file** (character/connection) - Optional - A connection or a character string naming the file to print to. If NULL, results are printed to the console. - **sep** (character) - Optional - Character string to insert between the objects to print if file is specified. - **...** (dots) - Optional - Further arguments passed to or from other methods. ### Request Example print.fahst(res.fahst, file="c:/fahst.csv", sep = ";") ``` -------------------------------- ### Plot Bootstrap Confidence Ellipses Source: https://context7.com/husson/sensominer/llms.txt Plots the confidence ellipses generated from bootstrap simulations. Requires the simulation results, confidence level (alpha), and eigenvalues. ```r # Plot ellipses using the simulation results plotellipse(res$simul, alpha = 0.05, eig = res$eig) ``` -------------------------------- ### Bootstrap Confidence Ellipses for Hierarchical Sorting Task Source: https://context7.com/husson/sensominer/llms.txt Generates bootstrap confidence ellipses for hierarchical sorting task data. Requires the data, method set to 'hsort', and a vector defining group memberships. ```r # Hierarchical sorting task data(cards) group.cards <- c(2,3,3,2,2,4,2,3,2,1,3,2,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3) res <- boot(cards, method = "hsort", group = group.cards) ``` -------------------------------- ### Generate MFA-based Confidence Ellipses Source: https://context7.com/husson/sensominer/llms.txt Creates MFA-based confidence ellipses for sensory data, allowing for grouping of variables. Requires specifying the input data, panelist and judge columns, number of choices, first variable, and optionally group definitions. ```r res2 <- panellipse(sensochoc, col.p = 4, col.j = 1, nbchoix = 12, firstvar = 5) res_mfa <- panellipse(sensochoc, col.p = 4, col.j = 1, firstvar = 5, group = c(6,8), name.group = c("Appearance","Taste")) ``` -------------------------------- ### Analyze Cards Dataset with FAHST Source: https://github.com/husson/sensominer/blob/master/man/cards.rd Perform a hierarchical sorting task analysis using the fahst function on the cards dataset. ```R data(cards) ## Example of FAHST group.cards<-c(2,3,3,2,2,4,2,3,2,1,3,2,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3) res.fahst<-fahst(cards,group=group.cards) ``` -------------------------------- ### pmfa - Procrustean Multiple Factor Analysis Source: https://context7.com/husson/sensominer/llms.txt Performs Multiple Factor Analysis combined with Procrustean Analysis for napping data, superimposing individual configurations on consensus. ```APIDOC ## pmfa - Procrustean Multiple Factor Analysis ### Description Performs Multiple Factor Analysis combined with Procrustean Analysis for napping data, superimposing individual configurations on consensus. ### Method Not specified (R function) ### Endpoint Not applicable (R function) ### Parameters - **napping.don** (data.frame) - Napping data. - **napping.words** (data.frame) - Words associated with napping data. - **dilat** (logical) - If TRUE, use Morand's dilatation. - **graph.ind** (logical) - If TRUE, show individual configurations. - **graph.mfa** (logical) - If TRUE, show MFA graphs. - **lim** (numeric vector) - Dimensions for the tablecloth. - **coord** (numeric vector) - Coordinates to use for analysis. ### Request Example ```r data(napping) # Visualize raw napping data nappeplot(napping.don) # Perform PMFA result <- pmfa(napping.don, napping.words, dilat = TRUE, # Use Morand's dilatation graph.ind = TRUE, # Show individual configurations graph.mfa = TRUE, # Show MFA graphs lim = c(60, 40), # Tablecloth dimensions coord = c(1, 2)) ``` ### Response - **RV coefficients** (numeric) - RV coefficients between individual and consensus configurations. Higher values indicate better agreement with consensus. ``` -------------------------------- ### Plot FAHST data for individuals Source: https://github.com/husson/sensominer/blob/master/man/plot.fahst.rd Plots the individuals and categories of FAHST data. Use 'invisible="var"' to hide category points and 'habillage=2' to color individuals by a specific level. ```R data(cards) group<-c(2,3,3,2,2,4,2,3,2,1,3,2,3,3,3,2,3,3,2,3,3,3,3,3,3,3,3,3,3,3) res.fahst <- fahst(cards,group,graph=FALSE) plot.fahst(res.fahst,choix="ind",invisible="var",habillage=2, title="Cards colored according to level 2 of subject 1") ```