This article describes how to transform MaxDiff preference share variables saved out of an analysis into a set of binary variables that can then be used in TURF.
- A Displayr document with preference share variables.
The way we'll get the highest-ranked alternative for each respondent is to work out which of the alternatives has the highest preference share for each respondent. Then replace the highest value with 1, and all others with a 0. We can do this with some R code.
- Select the MaxDiff you want to use in the TURF analysis.
- In the object inspector on the right, click Inputs > SAVE VARIABLE(s) > Preference Shares. This saves out the preference share data we'll need.
- Find the preference share variable set in the Data Sets tree.
- Click the small arrow next to the variable set to expand it:
- Select the first variable in the list. In my screenshot above it's the "Postnatal multivitamin..." variable.
- In the object inspector on the right, go to the Properties > R CODE box.
- Set the first line equal to "shares" like this:
- Then paste in the code below. You can skip the first 3 lines, just paste everything from "#find the max value across all attributes" on down.
- Click the red Calculate button at the top of the object inspector.
- Next, go back to the Data Sets tree and select the top of the variable set again:
- 11. With it selected, go to the object inspector on the right.
- Give this modified variable set a new Label and change the Structure drop-down to Binary - Multi
- Click the Fix button in the orange warning bar that appears and click OK through all of the boxes.
When you're done the variable set should look like this:
Now you can use this variable set as the input variables in your TURF.