DCE- error in syntax

This forum is for posts that specifically focus on Ngene.

Moderators: Andrew Collins, Michiel Bliemer, johnr

DCE- error in syntax

Postby lvanwijk » Thu Apr 09, 2020 10:58 pm

Hi everybody,

I have a question regarding creating a DCE and I couldn't find an answer in previous questions. For my research I want to examine the attitude of gynaecologists towards breech pregnancies with a DCE. For the DCE, I identified 5 attributes, and 2-3 levels. My plan was to present each gynaecologist 12 choice tasks made of various variables, and then they can choose option 1 (vaginal delivery) or option 2 (caesarean delivery).

Like this: (couldn't paste a table)

case .............| option 1: vaginal delivery .........| option 2: caesarean delivery
-------------------------------------------------------------------------------------------------
Mrs, 23 y, prim, .. | option 1 ,..... O ...............| .... option 2 ...........O
medical history: DM2
BMI: 30
estimated birth weight: normal

It’s my first time using NGENE, so my first question is: is it possible to design this kind of survey in NGENE and how?
Because while programming, I get an error and I'm not sure how many ‘alts’ I should use.

I tried this in Syntax (so far):
Design
? This will generate a fractional factorial design
; alts= alt 1, alt 2?
; rows = 12
; orth =seq
; model
U (alt1)= b1 + b2*A[0,1,2] + b3*B[0,1] + b4*C[0,1] + b5*D[0,1] +b6*E[0,1] /
U (alt2) = ?
$

Hopefully can anybody explain me what I'm doing wrong and what I can do to create a right survey?

Thanks in advance!

Kind regards, Lotte van Wijk
lvanwijk
 
Posts: 6
Joined: Thu Apr 09, 2020 9:43 pm

Re: DCE- error in syntax

Postby Michiel Bliemer » Sat Apr 11, 2020 9:50 am

Hi Lotte,

There are essentially three kinds of variables that you can add to your choice model:
(i) characteristics of the alternatives (i.e., attributes), which vary across alternatives and choice tasks
(ii) characteristics of the respondent (e.g., socio-demographics), which do not vary across alternatives and choice tasks that a respondent faces
(iii) characteristics of the choice context (i.e. scenario variables), which do not vary across alternatives but may vary across choice tasks

It is not clear to me which variables include below in your model, but my guess is that they are not attributes, but rather they are scenario variables. I assume that you present a gynaecologist with a patient identified by 5 characteristics, and then ask whether they would prefer vaginal delivery or caesarean delivery, is that correct? In that case, the model only has scenario variables and does not have any attributes (except for the alternative-specific constant that reflects the value of the label of the alternatives). Of course you could still add attributes that describe the alternatives if needed. See also section Section 8.5 of the Ngene manual. Given that the scenario variable is constant across all alternatives, you can only add the variable in one alternative, and the interpretation of the variable is relative to the other (base) alternative.

Your utility functions would be something like the following (where U(vaginal) = 0 is used as the base alternative and need not be specified):

Code: Select all
design
;alts = vaginal, caesarean
;rows = 12
;orth = seq
;model:
U(caesarean) = caes
             + age.dummy[0|0] * AGE[20,30,40]
             + hist.dummy[0|0] * HISTORY[1,2,3]
             + bmi.dummy[0|0] * BMI[20,30,50]
$


Michiel
Michiel Bliemer
 
Posts: 955
Joined: Tue Mar 31, 2009 4:13 pm

Re: DCE- error in syntax

Postby lvanwijk » Wed Apr 15, 2020 2:09 am

Hi Michiel,

Thank you so much for responding, that's exactly what I meant!
Hopefully it's okay if I ask you another question.
I originally tried it in Syntax like this (see below), but I keep having this:
- Error: The attribute level specification '[primi, multi]' is not valid. It either contains a value that is not a number, or is attempting to mimic an attribute that does not exist. ( so I changed it in a number)
- or this: Error: An attribute has the wrong number of levels for dummy or effects coding.

Design
;alts = vaginal delivery, caesarean delivery
;rows = 12
;orth = seq
;model:
U(vaginal delivery) = vaginal
+ age.dummy[0|0] * AGE[16-35,36-45]
+ bmi.dummy[0|0] * BMI[17-27,28-38]
+ parity.dummy[0|0] * PARITY[Primi, multi]
+ previous caesarean.dummy[0|0] * PREVIOUS CAESAREAN[yes, no]
+ underlying pathology.dummy[0|0] * UNDERLYING PATHOLOGY[yes, no]
+ estimated birthweight.dummy[0|0] * ESTIMATED BIRTHWEIGHT[2500-2900,3000-3300,3400-3800]
$

Isn't it possible to write letters (yes/no) or 16-35, and should it be one number?
And how do I write this (age.dummy[0|0] ) when there are only 2 options?

Thanks again!!!

Kind regards,

Lotte
lvanwijk
 
Posts: 6
Joined: Thu Apr 09, 2020 9:43 pm

Re: DCE- error in syntax

Postby Michiel Bliemer » Wed Apr 15, 2020 9:06 am

You can only use numbers as attribute levels. When using dummy or effects coding, you would typically use [1,2,3,..,0], where the last level (in this case, 0) is the reference level. You can use any numbers, they do not really matter, as long as they are numbers. In dummy coding, you attach actual labels to these numbers in the survey instrument, e.g. 0 = no, 1 = yes. But your experimental design always consists of numbers only. Ngene can also attach llabels to numbers in survey formatting, I refer to the Ngene manual, Section 10, page 197 and further.

Regarding dummy and effects coding, please read Section 7.2.8 of the Ngene manual (page 110 and further). For two levels, you use age.dummy[0], for three levels, you use age.dummy[0|0], for four levels, you use age.dummy[0|0|0], etc.

I would use this syntax:

Code: Select all
Design
;alts = vaginal_delivery, caesarean_delivery
;rows = 24
;block = 2
;orth = seq
;model:
U(vaginal_delivery) = vaginal
                    + age.dummy[0] * AGE[1,0]  ? 1 = 16-35, 0 = 36-45
                    + bmi.dummy[0] * BMI[1,0]  ? 1 = 17-27, 0 = 28-38
                    + parity.dummy[0] * PARITY[1,0]  ? 1 = Primi, 0 = multi
                    + previous_caesarean.dummy[0] * PREVIOUS_CAESAREAN[1,0]  ? 1 = yes, 0 = no
                    + underlying_pathology.dummy[0] * UNDERLYING_PATHOLOGY[1,0]  ? 1 = yes, 0 = no
                    + estimated_birthweight.dummy[0|0] * ESTIMATED_BIRTHWEIGHT[1,2,0] ? 1 = 2500-2900, 2 = 3000-3300, 0 = 3400-3800
$


Note that I have avoided spaces within a variable name, I have listed the labels of the dummy coded numerical levels. Further note that an orthogonal array does not exist with 12 rows in your situation, therefore Ngene will find one with 24 rows, which means that you will need to block your design in 2 versions (such that a respondent faces 12 choice tasks each).

Michiel
Michiel Bliemer
 
Posts: 955
Joined: Tue Mar 31, 2009 4:13 pm

Re: DCE- error in syntax

Postby lvanwijk » Thu Apr 16, 2020 1:33 am

Hi Michiel,

Thanks again for responding and showing me.
I can't add a picture, but after running the syntax iI see in properties a table with only '0's'.
Should I put a parameter after dummy? And how do I know which one?

And at which point do I add the 'Caesarean delivery'?

Thank you so much!

Lotte
lvanwijk
 
Posts: 6
Joined: Thu Apr 09, 2020 9:43 pm

Re: DCE- error in syntax

Postby Michiel Bliemer » Thu Apr 16, 2020 8:52 am

When you click properties, you should not see 0's for the D-error, A-error, etc. You will only see 0's for the priors because you put in zeros. Note that you have chosen an orthogonal design and for generating an orthogonal design all priors are ignored anyway.

If you want to put in non-zero priors, you will need to do a pilot study, estimate the parameters, and use these parameter estimates as your priors. Then with these non-zero priors you can generate an efficient design using ;eff = (mnl,d). Without a pilot study, they would remain zero and you can still generate an efficient design if you like, but an orthogonal design is fine as well.

In your survey instrument, in each choice task you state the scenario variable levels at the top and then create two choices, Vaginal delivery, and Ceasarean delivery. You will have to convert the experimental design manually to formatted choice tasks in the survey instrument.

An example of what it would look like in a survey instrument is what I show in this syntax using scenario formatting. If you run this syntax, open the design, and then click on the "Formatted scenarios" tab, you can see how the design is translated into survey questions.

Code: Select all
Design
;alts = vaginal_delivery, caesarean_delivery
;rows = 24
;block = 2
;orth = seq
;model:
U(vaginal_delivery) = vaginal
                    + age.dummy[0] * AGE[1,0]
                    + bmi.dummy[0] * BMI[1,0]
                    + parity.dummy[0] * PARITY[1,0]
                    + previous_caesarean.dummy[0] * PREVIOUS_CAESAREAN[1,0] 
                    + underlying_pathology.dummy[0] * UNDERLYING_PATHOLOGY[1,0] 
                    + estimated_birthweight.dummy[0|0] * ESTIMATED_BIRTHWEIGHT[1,2,0]
;formatTitle = 'Scenario <scenarionumber>'
;formatTableDimensions = 3, 10
;formatChoices = choice
;formatTable:
1,1 = 'Consider the following patient&:' /
1,2 = 'Age' /
1,3 = 'BMI' /
1,4 = 'Parity' /
1,5 = 'Previously had caesarean' /
1,6 = 'Underlying pathology' /
1,7 = 'Estimated birthweight' /
1,8 = '' /
1,9 = '' /
1,10 = 'I would prefer&:' /
2,1 = '' /
2,2 = '<vaginal_delivery.age>' /
2,3 = '<vaginal_delivery.bmi>' /
2,4 = '<vaginal_delivery.parity>' /
2,5 = '<vaginal_delivery.previous_caesarean>' /
2,6 = '<vaginal_delivery.underlying_pathology>' /
2,7 = '<vaginal_delivery.estimated_birthweight>' /
2,8 = '' /
2,9 = 'Vaginal delivery' /
2,10 = '<choice>' /
3,1 = '' /
3,2 = '' /
3,3 = '' /
3,4 = '' /
3,5 = '' /
3,6 = '' /
3,7 = '' /
3,8 = '' /
3,9 = 'Ceasarean delivery' /
3,10 = '<choice>'
;formatTableStyle:
1,1 = 'default' /
1,2 = 'headingattribute' /
1,3 = 'headingattribute' /
1,4 = 'headingattribute' /
1,5 = 'headingattribute' /
1,6 = 'headingattribute' /
1,7 = 'headingattribute' /
1,8 = 'default' /
1,9 = 'default' /
1,10 = 'default' /
2,1 = 'default' /
2,2 = 'body1' /
2,3 = 'body1' /
2,4 = 'body1' /
2,5 = 'body1' /
2,6 = 'body1' /
2,7 = 'body1' /
2,8 = 'default' /
2,9 = 'heading1' /
2,10 = 'choice1' /
3,1 = 'default' /
3,2 = 'default' /
3,3 = 'default' /
3,4 = 'default' /
3,5 = 'default' /
3,6 = 'default' /
3,7 = 'default' /
3,8 = 'default' /
3,9 = 'heading1' /
3,10 = 'choice1'
;formatStyleSheet = Blue buttons.css
;formatAttributes:
vaginal_delivery.age(1=16-35, 0=36-45) /
vaginal_delivery.bmi(1=17-27, 0=28-38) /
vaginal_delivery.parity(1=Primi, 0=multi) /
vaginal_delivery.previous_caesarean(1=Yes, 0=No) /
vaginal_delivery.underlying_pathology(1=Yes, 0=No) /
vaginal_delivery.estimated_birthweight(1=2500-2900 g, 2=3000-3300 g, 0=3400-3800 g)
$


Michiel
Michiel Bliemer
 
Posts: 955
Joined: Tue Mar 31, 2009 4:13 pm

Re: DCE- error in syntax

Postby lvanwijk » Sun Apr 26, 2020 11:19 pm

Hi Michiel,

thank you so much for your example.
In addition to your previous post, I hope you can tell me how I can program the syntax that each scenario exists of different (randomized) scenario variables?
In the previous one, each scenario is the same. There should be 108 possibilities, or should I do that manually?

Thanks in advance!
Lotte
lvanwijk
 
Posts: 6
Joined: Thu Apr 09, 2020 9:43 pm

Re: DCE- error in syntax

Postby Michiel Bliemer » Mon Apr 27, 2020 10:02 am

I am not sure I understand what you mean. The syntax creates 24 choice tasks with 24 different scenarios, the scenarios are not the same.
If you would like to have all possible scenarios in your design you should simply create a full factorial design, not an orthogonal design, using the command ;fact and ;rows = all. Randomly assigning choice tasks is done in the online survey instrument, so that depends on what online tool you will use.

Michiel
Michiel Bliemer
 
Posts: 955
Joined: Tue Mar 31, 2009 4:13 pm

Re: DCE- error in syntax

Postby lvanwijk » Mon Apr 27, 2020 8:15 pm

Thanks for your respons, I indeed need a ;fact design.
What I'm confused about is, that when running the syntax and clicking on formatted scenarios, all 108 scenarios are exactly the same.
This while I expected to find that all the scenarios would differ in variables (because 108 options). Am I wrong? Or do you know a way to obtain 108 different scenarios?

Thanks again,
Lotte
lvanwijk
 
Posts: 6
Joined: Thu Apr 09, 2020 9:43 pm

Re: DCE- error in syntax

Postby Michiel Bliemer » Mon Apr 27, 2020 8:32 pm

When you open the design and you look at the properties tab, can you see that each row has a different combination of attribute levels?

If the levels are all zero, then you have not registered your Ngene licence and at the top of the window it will mention "evaluation mode". In this case, Ngene defaults to all zeros in the design and therefore all scenarios will be the same, so in that case please register your Ngene licence via Help | online activation.

If the rows indeed show different combinations of attribute levels, then each choice task will show a different type of patients in the formatted scenarios tab. In the full factorial design, the first patient will have the following characteristics:

Age: 16-35
BMI: 17-27
Parity: Primi
Previously had caesarean: Yes
Underlying pathology: Yes
Estimated birthweight: 2500-2900 g

The second patient will have a different estimated birthweight, namely 3000-3300 g

Et cetera.

Btw, my full factorial shows 96 different types of patients, not 108.
Michiel Bliemer
 
Posts: 955
Joined: Tue Mar 31, 2009 4:13 pm

Next

Return to Choice experiments - Ngene

Who is online

Users browsing this forum: No registered users and 2 guests

cron