Learn R Programming

SensoMineR (version 1.27)

averagetable: Computes a (products,descriptors) matrix

Description

Returns the (products,descriptors) matrix with entries the means over panelists and sessions.
Computes analyses of variance automatically for a given model and a set of quantitative variables. Returns a data matrix where each row is associated with each category of a given categorical variable (in most cases, the categorical variable is the product variable), each column is associated with a quantitative variable, and each cell is the corresponding adjusted mean or mean.
Computes the average data table with respect to a categorical variable and a set of quantitative variables.

Usage

averagetable(donnee, formul, subset = NULL, method = "coeff", 
    firstvar, lastvar = ncol(donnee), file = NULL)

Value

Return a matrix of dimension (p,q), where p is the number of categories of the qualitative variable of interest (in most cases, p is the number of products) and q is the number of (sensory) descriptors. If "coeff" is assigned to the method parameter then the function averagetable returns the matrix of the adjusted means; if "mean" is assigned to the method parameter then the function averagetable returns the matrix of the means per category.

Arguments

donnee

a data frame made up of at least two qualitative variables (product, panelist) and a set of quantitative variables (sensory descriptors)

formul

the model with respect to which the factor levels of the categorical variable of interest are calculated

subset

an optional vector specifying a subset of observations to be used in the fitting process

method

two possibilities, "coeff" (by default) or "mean"

firstvar

the position of the first endogenous variable

lastvar

the position of the last endogenous variable (by default the last column of donnee)

file

the name of the output file (by default, NULL and results are not in a file)

Author

Francois Husson francois.husson@institut-agro.fr

Details

The formul parameter can be filled in for a given analysis of variance model. The formul parameter must begin with the categorical variable of interest (generally the product variable) followed by the different other factors (and eventually their interactions) of interest. Classicially, one can used formul = "~Product+Panelist+Product:Panelist". In practise and in our type of applications, this function is very useful to obtain a data matrix in which rows represent products and columns represent sensory descriptors.
If "mean" is assigned to the method parameter, then the formul parameter can be restricted to the sole variable of interest (generally the product variable).
If data are balanced, the two options "mean" and "coeff" give the same results.

References

P. Lea, T. Naes, M. Rodbotten. Analysis of variance for sensory data.
H. Sahai, M. I. Ageel. The analysis of variance.

See Also

Examples

Run this code
data(chocolates)
resaverage<-averagetable(sensochoc, formul = "~Product+Panelist",
    firstvar = 5)
coltable(magicsort(resaverage), level.upper = 6,level.lower = 4,
    main.title = "Average by chocolate")

res.pca = PCA(resaverage, scale.unit = TRUE)

Run the code above in your browser using DataLab