Choice Modeling - Ensemble of Models

From Q
Jump to navigation Jump to search


The output may either be a table comparing the underlying models and the ensemble, or histograms of respondent parameters of the ensemble. In either case, functions to save variables (e.g. Individual-Level Coefficients) may be applied to the ensemble.

How to Create

  1. Add the object by selecting from the menu Anything > Advanced Analysis > Choice Modeling > Ensemble of ModelsAutomate > Browse Online Library > Choice Modeling > Ensemble of Models
  2. In Inputs > Input models select at least 2 choice models

Example

Output Example:
Comparison table


Input Example:
Histograms of ensemble parameters


Options

Input models At least 2 Choice Models.

Ensemble Whether to create an ensemble by taking the average of the respondent parameters across the models.

Output

Comparison A table comparing metrics from models (and the ensemble, if selected).
Ensemble Histograms of respondent parameters, as per the underlying Choice Model outputs.

SAVE VARIABLE(S)

Save individual-level coefficients Saves variables that contain the estimated coefficients for each case (e.g., respondent).

Save proportion of correct predictions Saves a variable to the data set containing the proportion of correct predictions for each each case (e.g., respondent).

Save utilities (mean = 0) Saves variables that contain utilities scaled to have mean of 0 (within each attribute).

Save utilities (min = 0, mean range = 100) Saves variables that contain utilities scaled to have a minimum of 0 (within attribute) with a mean range of 100 (for each case).

Save utilities (min= 0, max range = 100) Saves variables that contain utilities scaled to have a minimum of 0 (within attribute) with a maximum range of 100 (for each case).

Save utilities (min = 0) Saves variables that contain utilities scaled to have a minimum of 0 (within each attribute).

Save utilities (mean = 0, mean range = 100) Saves variables that contain utilities scaled to have a mean of 0 (within attribute) with a maximum range of 100 (for each case).

Save utilities (mean = 0, max range = 100) Saves variables that contain utilities scaled to have a mean of 0 (within attribute) with a maximum range of 100 (for each case).

Additional Properties

When using this feature you can obtain additional information that is stored by the R code which produces the output.

  1. To do so, select Create > R Output.
  2. In the R CODE, paste: item = YourReferenceName
  3. Replace YourReferenceName with the reference name of your item. Find this in the Report tree or by selecting the item and then going to Properties > General > Name from the object inspector on the right.
  4. Below the first line of code, you can paste in snippets from below or type in str(item) to see a list of available information.

For a more in depth discussion on extracting information from objects in R, checkout our blog post here.

Code

var controls = [];
var modelsInput = form.dropBox({label: "Input models", types:["RItem:FitChoice"], name: "formModels",
                               multi: true, required: true, min_inputs: 2,
                               prompt: "Select at least 2 Choice Models."});
controls.push(modelsInput);

var ensemble = form.checkBox({label: "Ensemble", name: "formEnsemble", default_value: true,
                              prompt: "Whether to create an ensemble of the models."});
controls.push(ensemble);

if (ensemble.getValue()) {
    var output = form.comboBox({label: "Output", 
              alternatives: ["Comparison", "Ensemble"], name: "formOutput", default_value: "Comparison",
              prompt: "A table comparing the models, or histograms of ensemble respondent coefficients."});
    controls.push(output);
}
form.setInputControls(controls);

var heading_text = 'Compare Choice Models';
var plural_text = 'Comparisons of Choice Models';
if (ensemble.getValue()) {
  heading_text = 'Ensemble of Choice Models';
  plural_text = 'Ensembles of Choice Models';
}
if (!!form.setObjectInspectorTitle)
    form.setObjectInspectorTitle(heading_text, plural_text);
else 
    form.setHeading(heading_text);
library(flipChoice)
ensemble <- ChoiceEnsemble(formModels,
                           !formEnsemble,
                           get0("formOutput", ifnotfound = "Comparison"))