This article describes how to compute shares from numeric data at the case (i.e., respondent) level. The table below shows the average number of hours spent during the week doing each of the activities:
And below is the table of the new variable created where the case-level share has been computed.
Requirements
- A Displayr document containing numeric data.
Method
- Select the numeric variable in the Data Sources that you would like to compute the case-level shares.
- While hovering over the selected variable, click Plus (+) > Numeric Transformations > Scale > Shares Within Case (formerly named Case-Level Shares).
- OPTIONAL: A simpler and often better method for computing shares is to use the share statistics available in the table object inspector under Data > Statistics > Cells. Generally, the shares computed when showing the Average of the variables created using this QScript will differ from those obtained if selecting one of the shares from Data > Statistics > Cell, as the Average will show the average of the shares computed at the respondent (case level), whereas the shares computed using Data > Statistics > Cell is created by summing up the data for each case and thus give greater weight to cases with larger values.
Technical Details:
- Data with missing values will have shares of NaN for all variables.
- Where data contains negative values, negative shares will be computed.