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.
- A Displayr document containing numeric data.
- Select the numeric variable in the Data Sets tree that you would like to compute the case-level shares.
- Perform any one of these methods:
- From the object inspector, go to Inputs > TRANSFORMATIONS > Case-Level Shares.
- While hovering over the selected variable in your Data Sets tree > Plus (+) > Insert Variable(s) > Ready-Made New Variable(s) > Case-Level Shares
- From the toolbar, select Anything > Data > Variables > New > Ready-Made New Variable(s) > Case-Level Shares.
- OPTIONAL: A simpler and often better method for computing shares is to use the share statistics available in the object inspector under Inputs > 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 Inputs > STATISTICS > Cell, as the Average will show the average of the shares computed at the respondent (case level), whereas the shares computed using Inputs > STATISTICS > Cell is created by summing up the data for each case and thus give greater weight to cases with larger values.
- Data with missing values will have shares of NaN for all variables
- Where data contains negative values, negative shares will be computed