This article describes how to calculate an average value from categorical data in Displayr.
The traditional means for outputting categorical data is with percentages representing each category's share of the total sample. However, there are a range of cases where it is useful to calculate an average value based on the categories.
This requires that each category in the data be associated with a meaningful value, so that the average is also meaningful. In this post, we look at how to assign numeric values categories in Displayr so that averages can be calculated.
A Displayr document with categorical variables containing ranges. For example:
To calculate the average value for a categorical question, a numeric value must be assigned to each category. In the following case, respondents were asked to choose from categorical, single-response options with numeric range labels instead of asking respondents to enter a specific value.
In order to calculate an average in this situation, a numeric value must be assigned to each category that best represents the entire category. The commonly accepted best practice for this is with midpoint coding. This process codes the value for each category with its midpoint with the limitation that this average will only be an estimate or a “ballpark” value.
Step 1: Recode values in Displayr
- Select a Variable Set from the Data Sets section in the bottom left.
- Click the Value Attributes button in the Object Inspector on the right.
- Enter appropriate values for each category in the Value column.
- Click OK.
Step 2: Show the Average Statistic
Once you have confirmed these settings, you can add the average statistic to the bottom of the table.
- Drag the Variable Set onto your page.
- In the Inputs section of the Object Inspector, change the STATISTICS > Below to include Average.
Step 3: Change variable set structure to Numeric / Numeric - Multi
If the only statistic you want to show on a table is the average, changing the variable set Structure into either Numeric or Numeric - Multi format can be a more sensible and direct option. By default, Displayr will always output the average statistic on tables utilizing these question types. Changing the structure makes it much easier to create crosstabs when comparing results for multiple items.
To do so:
- Select a variable set from Data Sets.
- In the Properties section of the Object Inspector, change the question structure to either Numeric or Numeric - Multi.