Marketing - MaxDiff - Compare Models

From Q
Jump to navigation Jump to search

Compare the performance of multiple MaxDiff models by producing a table of metrics from each model.

Example


To run the Compare Models function in Displayr, select Anything > Advanced Analysis > MaxDiff > Compare Models.
To run in Q, select Create > Marketing > MaxDiff > Compare Models.

Options


MaxDiff models created in Displayr or Q are used as the inputs for the model comparison. The inputs are shown in the image below.

Comparemodels inputs.PNG


Input models At least 2 MaxDiff models.

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


More information

See Comparing MaxDiff Models blog post for an example of comparing models.


Code

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

var ensemble = form.checkBox({label: "Ensemble", name: "formEnsemble", default_value: false,
                              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 MaxDiff Models';
var plural_text = 'Comparisons of MaxDiff Models';
if (ensemble.getValue()) {
    heading_text = 'Ensemble of MaxDiff Models';
    plural_text = 'Ensembles of MaxDiff Models';
}

if (!!form.setObjectInspectorTitle)
    form.setObjectInspectorTitle(heading_text, plural_text);
else 
    form.setHeading(heading_text);
library(flipMaxDiff)
comparison <- MaxDiffEnsemble(formModels,
                              !formEnsemble,
                              get0("formOutput", ifnotfound = "Comparison"))

Further reading: MaxDiff software