This article describes how to calculate an average value from categorical data.
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.
Requirements
A Displayr document with categorical variables containing ranges. For example:
Method
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 from the Data Sets tree.
- From the object inspector, select Inputs > DATA VALUES > Values.
- Enter appropriate values for each category in the Value column. If you'd like a category to still show up in the table but be excluded from the Average or other mathematical calculations, delete the Value, this should automatically change Missing Values > Include in percentages (but not averages).
- 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 onto your page to create a table.
- 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 to 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 or variable set from the Data Sets tree.
- In the GENERAL > Properties > Structure section of the object inspector, update to either Numeric or Numeric - Multi.
Next
How to Exclude Don't Knows from Averages but Include in Percentages
How to Recode High Values (Capping) in Numeric Variables
How to Recode Low Values (Capping) in Numeric Variables
How to Recode Into Existing or New Variables
How to Change a Variable Set From Displaying Percentages to Averages