Choice Modeling - Diagnostic - Experimental Design - Numeric Design extension
Jump to navigation
Jump to search
Create an output containing a numeric version of the design
Outputs a numeric version of a Choice Modeling - Experimental Design output, with the labels of attributes replaced by integers.
Example
The table below shows the numeric version of a design with 2 attributes, Color and Speed, each of which has 3 levels.
References
See Choice Modeling - Experimental Design
Code
includeWeb("QScript R Output Functions");
var is_displayr = (!!Q.isOnTheWeb && Q.isOnTheWeb());
if (!is_displayr)
{
if (Q.fileFormatVersion() >= 17.13)
main();
else
alert("Please update Q to use this feature from the extension button, or run it from the menu via Automate > Browse Online Library > Choice Modeling > Diagnostic > Experimental Design > Numeric Design.");
}
else
{
main();
}
function main() {
// The following 2 variables contain information specific to this diagnostic.
var required_class = "ChoiceModelDesign";
var output_name_suffix = "numeric.design";
var item = checkSelectedItemClass(required_class);
if (item == null)
return false;
var r_name = stringToRName(item.referenceName);
// The following lines contain the R code to run
var expression = "sapply(" + r_name + "$labeled.design, as.numeric)";
return createROutput(item, expression, output_name_suffix);
}