Choice Modeling - Legacy Choice Modeling - Choice-Based Conjoint (CBC) Setup - JMP

From Q
Jump to: navigation, search

This QScript sets up an Experiment question for a choice-based conjoint study, where the experimental design is contained in a CSV or Excel file. The specific structure of the CSV and Excel files is assumed to match those created by JMP, and it is usually straightforward to convert experimental designs in other formats to be consistent with this format (see below).

Technical details

This QScript requires that:

  • You have two or three files:
    1. A data file containing variables that describe which choice tasks were seen by each individual (or respondent) and the choices that were made for each task. This file should be imported into a Q project before running this script.
    2. A CSV or Excel data file containing the experimental design from JMP.
    3. (Optional) A CSV or Excel file containing the labels for the levels of each of the attributes in the experimental design. This file needs to be created by hand (i.e. it is not produced by JMP).
  • Each choice task contains the same number of alternatives and that each individual faced the same number of choice tasks. Note that experiments not consistent with the assumption can still be set up manually. See other formats, Choice Modeling - Choice-Based Conjoint (CBC) Setup - Sawtooth Dual File Format, and Experiments Specifications for details on setting up choice models with different specifications.
  • Each individual's data is stored in a single case (row) in the data file.

Overview of what happens when you run this QScript

  • When the QScript runs you will be prompted to specify:
    1. Which variables contain the numbers of the tasks seen by each individual.
    2. Which variables contain the choices selected by each individual in each task.
    3. The location and name of the file containing the experimental design.
    4. (Optional) The location and name of a file containing the labels of the levels of each attribute.
    5. Whether or not a None of these option was included in the choice tasks.
    6. Whether or not you want to include alternative-specific constants.
  • Upon completion of the QScript you will have a SUMMARY table of an Experiment question, which shows the parameters for a multinomial logit model. See Experiments for more information.

JMP experimental design format

The standard format for the JMP design is illustrated in this example:

JMPDesign1.PNG

Note that:

  • There is one alternative per row.
  • Each unique choice task is given a number, and this is found in the column of the design file called Choice Set. Thus, in the example above, there are three alternatives per choice set. The Choice Set should begin at 1 for the first task, and increase by 1 for each subsequent task.
  • The block number is stored in the Survey column. For example, if each individual sees the same choice sets, then the value 1 appears for all the cells in this column; if there are two versions of the choice sets, then the number 1 appears next rows in the first block and 2 next to those in the second block. Note that while this column appears in JMP designs, its use is when programming the data collection and it has no role in the analysis, so if you are setting up data manually, you can just assign a 1 to all rows in the design.
  • All the values in the design are indicated with consecutive positive integers (i.e., 1, 2, 3, ...). Where a choice set does not contain an attribute, it should be shown as a 1 in the experimental design (as 1 is the index value that everything is else compared against, and thus has a utility of 0). Note that some care should be taken if re-ordering attribute levels within Q in such instances.

The data file

The data file that contains information on which tasks the individuals saw and which options the individuals chose should be imported into a Q project before running this QScript. There should be one case in the data file for each individual, so that when each individual faces multiple choice tasks, these tasks are spread across multiple variables and NOT multiple cases.

The data set should contain a set of variables that indicate the Choice Set number seen by each individual in each task, which matches the JMP Experimental Design. For example, if the individuals each make 8 choices then there should be 8 variables, and the first of these variables should contain the Choice Set number of the first question (i.e., task) seen by each individual, the second variable should contain the set number of the second question seen by each individual, and so on.

The variables that store the individuals' choices should be set with the Variable Type of Categorical and each should contain the number of the option that was chosen by the individual in the corresponding choice task. For example, if there are 3 alternatives per task then the choice variables should contain values 1, 2, and 3. For an experiment where each individual faces 8 tasks, there should be 8 choice variables, with the first containing the value of the choice made by the individuals in the first choice task, the second containing the value of the choice made by the individuals in the second task, and so on. The script will make a copy of these variables to use for the Experiment question, and each will be relabeled as "Choice".

Attribute labels

The file containing the labels for the levels should contain one column for each attribute, with the labels of each level for that attribute labeled in order. For example:

JMPDesignLabels1.PNG

If no file is specified then the attribute levels will be labeled with the numbers as they appear in the experimental design. These can be changed later by highlighting the variables for a single attribute in the Variables and Questions tab and editing the Values (...) to update the labels.

Alternative-specific constants

The option to add alternative-specific constants adds an additional attribute to the Experiment question that has one level for each alternative. This allows for the estimation of a coefficient for each alternative (eg 1st, 2nd, 3rd).

Other formats

The format described above is produce by JMP. If you have a design in a similar format then it may be relatively easy to convert your design so that it can be read by this QScript. The QScript includes some additional flexibility to allow for variations of the format described above.

If converting a design for use by this script then the following conditions must be satisfied:

  1. The first three column headers must be Survey, Choice Set, and Choice ID.
  2. The column Choice Set must indicate the numeric label for each of the possible choice tasks in the experiment. This must be sequential, beginning at 1 and ending at the number of choice tasks in the experiment. This number will be repeated for alternatives that belong to each task.
  3. Each task must have the same number of alternatives, and this number of each alternative should be contained in the column Choice ID. For example, if there are three alternatives in each task then this column will contain the sequence 1, 2, 3 repeated for each task.
  4. Each subsequent column must contain an attribute label as its heading, and must contain the level of that attribute that was shown in the alternative and task for that row. This can either be numeric (as in the above JMP specifications) or it can be labels for the attribute levels (as described below).

Designs with labels

Instead of values (1, 2, 3, etc) this QScript can accept design data files that instead contain the labels associated with each of the attribute labels. In this case, all labels should be text rather than numbers. If the labels labels for an attribute are purely numeric you should add some text to the beginning or end so that they may be read correctly by the script. If the attribute is truly numeric then once the script is complete you should change the Variable Type of the variables associated with this attribute to Numeric and you should edit the Values(...) of the variables to ensure they are coded appropriately.

'None of these' options

If your experimental design contains a 'None of these' option in each choice task which is not stored explicitly in the design then you can indicate this when you run the script. An additional alternative will be added to each task which has missing values for each of the alternatives (as indicated in Experiments Specifications). This option assumes that the 'None of these' option is the last option in the choice task.

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

  • Copy the JavaScript shown on this page.
  • Create a new text file, giving it a file extension of .QScript. See here for more information about how to do this.
  • Modify the JavaScript (see QScripts for more detail on this).
  • Run the file using Automate > Run QScript (Macro) from File.

JavaScript

// Setup Conjoint Experiment Question From a JMP Conjoint Design
includeWeb('QScript Selection Functions');
includeWeb('QScript Utility Functions');
includeWeb('QScript Functions for Setting Up Experiments');

var design_type = "JMP";
try {
	CBCSetupFromDesign(design_type)
} catch (e) {
	if (e instanceof SetupError)
		log(e.message);
	else
		throw e;
}


See also