## Introduction

When conducting a choice experiment, it can be useful to calculate the D-Error. This article shows you how to do it.

### 1. Preparing the Design

The design needs to be in the form of an R output table. If the design is not already in this form, the easiest way to input external data is by clicking on

**Create****> Tables > Enter Data**in the menu at the top.

This should create a new R output called table. Click on the red “Paste or type data” button on the right-hand side and a spreadsheet editor dialog box should appear.**Enter the design into the cells**; alternatively, they can be pasted in from Excel.

The design needs to be in the form of an R numeric matrix where the first column contains the version number, the second column contains the task number, the third column contains the question number and the fourth column contains the alternative number.

The subsequent columns contain levels for each attribute, represented by numbers starting from 1. I’ve provided an example of a small design matrix — 2 versions, 3 questions per version, 2 alternatives per question and 3 attributes (2,2,3 levels) — below:- Click
**OK**button - Click
**Calculate**.

The design should appear as a table in the output area.

### 2. Computing D-error

Compute D-error using R code through an R Output.

- Click
**Create > R Output**in the menu. - In the
**R Code**box, enter the following code:</pre>

library (flipChoice)

attribute.levels <- c(2,2,3)

DError(`table`, attribute.levels,effects = FALSE)

<pre>

You’ll need to replace the assignment to the variable attribute.levels with the appropriate vector. In this example, I’ve assigned it c(2,2,3)because there are 2, 2 and 3 levels in the three attributes in the design.

- Once you have modified the R Code, click
**Calculate.**The D-error should appear in the output. The default number of decimal places shown is 1. If this is insufficient, you can increase the number of decimal places shown via the toolbar in the top left of the window.Note that by setting effects = FALSE, I have chosen to use dummy coding instead of effects coding. Since I have not passed in priors for the parameters, D

_{0}-error will be computed in this case. 3.

### 3. Specifying Priors

Priors are specified as an extra parameter in the call to DError. When prior is a vector of parameters, D_{P}-error is computed. For example:

</pre>

prior < c(0.5, 1.0, -1.0, -2.0)

DError (1table1, attribute.levels, effects = FALSE, prior = prior)

<pre>

How to Create an Experimental Design for Conjoint Analysis

How to Create a MaxDiff Experimental Design in Q

How to Use Simulated Data to Check Choice Model Experimental Designs Using Q

## Comments

0 comments

Article is closed for comments.