Desktop User Guides > Professional > Table scripting > Table specification syntax > Special elements > Displaying a mean based on factors
Displaying a mean based on factors
Sample Script File: SpecialElements.mrs
This example script is based on the Museum sample data set. See Running the sample table scripts for information on running the example scripts.
rating[{Dinosaurs}].Column{.., mean()}
This creates an axis based on all of the elements in the rating[{Dinosaurs}].Column variable with the addition of a special mean element that shows the mean value of the factors associated with the variable. (Factors are automatically used when you do not specify a numeric variable.)
A factor is a constant numerical value that can be assigned to an element in a categorical variable for use in statistical calculations. Factors are used when you want to base a statistical element on the categories of a categorical variable rather than on a numeric variable. This is because statistics can be calculated on numeric data only and categories are not true numeric values. (Although the Data Model represents the responses to categorical questions as numeric values, these are in fact identifiers or codes and are not suitable for statistical analysis.)
The rating[{Dinosaurs}].Column variable is the Dinosaurs “slice” of a grid question, which asks respondents to rate the various galleries in the museum. Here is the grid question:
This graphic is described in the surrounding text.
Factors have been assigned to the categories as shown in the following table.
Not at all interested
Not particularly interested
No opinion
Slightly interested
Very interested
The mean element in this example shows the average factor value for categories chosen by the respondents, and this can give an indication of the general feeling among all of the respondents. In this example, a high mean factor value indicates that on average the respondents gave the Dinosaurs gallery a high rating.
Here is a table that has this axis on the side:
This graphic is described in the surrounding text.
Note that when no factors are defined, the mean will be zero. You can set factor values for elements in the axis specification. See Element properties for more information.
See also
Special elements