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.

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 their combinations) of interest. E.g.: 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.

Outputs

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.

method="coeff"   averagetable(chocolates, formul="~Product+Panelist", firstvar=5)
method="mean"   averagetable(chocolates, method="mean", formul="~Product", firstvar=5)