This QScript sets up a MaxDiff experiment in Q using an experimental design that is stored in a spreadsheet. For this to work, the files need to be set up according to the details below.
Technical details
You will be prompted to:
- Select the variables that contain the best or most-preferred option for each task.
- Select the variables that contain the worst or least-preferred option for each task.
- Select the file that contains your experimental design.
- Select the file that contains the labels of the alternatives (only if the labels of the alternatives are not contained in the best/worst variables).
- Select the variable that determines which version of the design was shown to each respondent (only if there is more than one version).
Setting up the data
Two or three files are required for the setup. You need:
- A Q project with a data file containing the version and which options were chosen as best and worst. See the section on Standard analyses for MaxDiff on the Displayr wiki for more details and DIY MaxDiff for example data files.
- A CSV or XLSX file containing the experimental design, set up as described in the section on setting up an experimental design in the MaxDiff page on the Displayr Wiki. You can download examples to compare from DIY MaxDiff.
- If the variables in your Q Project file that contain the choices of best and worst have inconsistent Value Attributes (see the Displayr Wiki for more information about this), with the values and labels relating to which option was chosen (e.g., "Option 1", "Option 2"), you will also be asked for a a third CSV or XLSX file that contains the labels of the aternatives, as shown below:
Worked example
- The QPack File:MaxDiffSetupExample.QPack contains the data file set up in the manner assumed by this script.
- The Excel file File:ExampleMaxDiffDesign.xlsx contains the design.
- The Excel file File:ExampleMaxDiffLabels.xlsx contains the labels for the alternatives.
To run the worked example:
- Download the Excel files.
- Download the QPack and open it.
- Run the script using Automate > Browse Online Library.
How to apply this QScript
- Start typing the name of the QScript into the Search features and data box in the top right of the Q window.
- Click on the QScript when it appears in the QScripts and Rules section of the search results.
OR
- Select Automate > Browse Online Library.
- Select this QScript from the list.
Customizing the QScript
This QScript is written in JavaScript and can be customized by copying and modifying the JavaScript.
Customizing QScripts in Q4.11 and more recent versions
- Start typing the name of the QScript into the Search features and data box in the top right of the Q window.
- Hover your mouse over the QScript when it appears in the QScripts and Rules section of the search results.
- Press Edit a Copy (bottom-left corner of the preview).
- Modify the JavaScript (see QScripts for more detail on this).
- Either:
- Run the QScript, by pressing the blue triangle button.
- Save the QScript and run it at a later time, using Automate > Run QScript (Macro) from File.
Customizing QScripts in older versions
Next
- QScript for more general information about QScripts.
- QScript Examples Library for other examples.
- Online JavaScript Libraries for the libraries of functions that can be used when writing QScripts.
- QScript Reference for information about how QScript can manipulate the different elements of a project.
- JavaScript for information about the JavaScript programming language.
- Table JavaScript and Plot JavaScript for tools for using JavaScript to modify the appearance of tables and charts.
Further reading: MaxDiff software