Millisecond Forums

Branching and multiple response modes

https://forums.millisecond.com/Topic14994.aspx

By teilai - 11/13/2014

I am new to Inquisit, but I have computing background, so scripting per se is not a problem.
I have not found a solution or an example to answer the following two questions.

1. how to make a branch which is based on the number of certain responses the participant has given in the past. Example, on the paper questionnaire: "If you answered YES three or more times, answer the following 2 questions." I want the Inquisit to implement the branching, not the participant.
2.  How to have several answers using different response modes to a single question? For instance two likert scales and a textbox.
Thank you for any help!

By Dave - 11/13/2014

Re. #1: Use a <values> entry (i.e. a global variable), sum up the "certain" responses in that value via /ontrialend attributes in your <trial>(s), /branch based on that value.

Re. #2: You need to set up a <surveypage> and put <radiobuttons> and <textbox> elements on it as needed.
By teilai - 11/19/2014

Dave (11/14/2014)
Re. #1: Use a <values> entry (i.e. a global variable), sum up the "certain" responses in that value via /ontrialend attributes in your <trial>(s), /branch based on that value.

Re. #2: You need to set up a <surveypage> and put <radiobuttons> and <textbox> elements on it as needed.


#1: My trials are /text elements (with a likert scale associated to them), so they don't contain /ontrialend attribute. I am not sure how to combine that to trials element. Maybe I can use /likert element's /ontrialend?
#2: Are you suggesting that I create a separate <surveypage> for each question? That's the only way I've figure out so far ...
By Dave - 11/19/2014

Re. #1: A <likert> element is a special type of <trial>, as is a <surveypage> element. All of them have /ontrialend attributes.

Re #2: No, you do not necessarily need to create a separate <surveypage> for each question.

<values>
/ myquestion = ""
/ myscore = 0
</values>

<block myblock>
/ trials = [1-3=mypage]
</block>

<surveypage mypage>
/ ontrialbegin = [values.myquestion=list.questionlist.nextvalue]
/ ontrialend = [if (radiobuttons.myrb.response=="certain") values.myscore+=1]
/ caption = "<%values.myquestion%>"
/ questions = [1=myrb; 2=mytb]
/ showpagenumbers = false
/ showquestionnumbers = false
</surveypage>

<radiobuttons myrb>
/ options = ("certain", "uncertain")
</radiobuttons>

<textbox mytb>
</textbox>

<list questionlist>
/ items = ("Question 1", "Question 2", "Question 3")
</list>

<data>
/ columns = [date time subject blocknum blockcode trialnum trialcode latency response values.myquestion values.myscore]
/ separatefiles = true
</data>

By teilai - 11/23/2014

Thanks for the help. Following the advice, I get the different question types (radiobuttons and the textbox) show up correctly, but the question text does not (the elements in the list)

And the branching does not work at all. I have a block:
<block part_1>
/preinstructions = (instr_p1)
/trials = [1-2 = consomm1; 3-9 = consomm2; 10-11 = consomm2hi; 12-15 = consomm3; 16-17 = consomm3ef]
/branch = [if (values.myscore2 < 3) likert.consomm3]
/branch = [if (values.myscore3 == 0) 0]
</block>

Basically what I want to do, is to count how many times the participants answers "Yes" to trials in consomm2, and if they do at least 3 times, ask them extra questions in consomm2ih, otherwise jump to consomm3. The other branch command works essentially the same, only that only 1 "Yes" is required. Which ever way I give the condition, the extra questions are always asked, even if I don't give a single "Yes" response. The questions are text elements with likert scales attached to them. And they work fine, the branching does not. From elsewhere in this forum I've understood that I should branch to the likert element, not the text element. Still, when I run the script I get the error message that consomm3 in the branch command is wrong type.
By Dave - 11/23/2014

Your /branch attributes ought to reside at the <trial> / <likert> / <surveypage> level, not the <block> level.

I cannot speak on the topic of

" I get the different question types (radiobuttons and the textbox) show up correctly, but the question text does not (the elements in the list)"

since you do not provide any relevant code. I am also confused with your references to likert elements ("The questions are text elements with likert scales attached to them.") -- <surveypage>s and <likert>s are different things.
By teilai - 11/24/2014

Dave (11/24/2014)
Your /branch attributes ought to reside at the <trial> / <likert> / <surveypage> level, not the <block> level.


I have the counter for "yes" responses in the likert element:
<likert consomm2>
/anchors = [1="Oui"; 2="Non"]
/stimulusframes = [1 = consomm2]
/ontrialend = [if (likert.consomm2.response==1) values.myscore2+=1]
/mouse=true
/numpoints=2
/position= (50, 80)
</likert>

I don't understand how it would ever work if I have the branch there too, since all questions need to be answered, and what happens next depends on how many "yes" responses there were.


since you do not provide any relevant code. I am also confused with your references to likert elements ("The questions are text elements with likert scales attached to them.") -- <surveypage>s and <likert>s are different things.


There were two issues in my original post, one has to do with branching and the other with how to have several different responses to a single question.
A surveypage was suggested to solve the latter. I have:
<surveypage alimentation>
/questions = [1 = consommation; 2 = quantite; 3 = mode]
/ontrialbegin = [values.myquestion=list.questionlist.nextvalue]
/ontrialend = [if (radiobuttons.consommation.response=="Non") list.questionlist.nextvalue]
/caption = "<%values.myquestion%>"
/showpagenumbers = false
/showquestionnumbers = false
</surveypage>

<list questionlist>
/items = ["Orange, citron, clémentines, pamplemousse", "Prunes, pruneaux", "Courgette, potimarron, ou autre courge", "Salade", "Noix",
"Maquereau", "Sardine ou hareng", "Saumon", "Esturgeon", "Merlu, truite", "Boeuf", "Porc", "Agneau", "Cheval", "Volaille", "Œuf",
"Sucre blanc", "Sucre roux", "Miel", "Confiture", "Pâte à tartiner au chocolat", "Rapadura", "Aspartame", "Huile d'olive",
"Huile de tournesol", "Huile de noix", "Huile de lin", "Huile de bourrache ou onagre", "Huile de soja", "Huile de cameline",
"Huile de colza", "Huile de palme ou coco"]
</list>

<radiobuttons consommation>
/caption = "Consommation"
/options = ("Oui" , "Non")
/position = (50, 20)
/required = false
</radiobuttons>

<textbox quantite>
/caption = "Quantité (en grammes)"
/required = false
/position = (50, 50)
</textbox>

<radiobuttons mode>
/caption = "Mode de préparation"
/options = ("Cru" , "Cuit")
/required = false
/position = (50, 70)
</radiobuttons>

The radiobuttons and the textbox show up properly, but the questions in the list do not. And the branch does not work either.
By Dave - 11/24/2014

#1: You state

"Basically what I want to do, is to count how many times the participants answers "Yes" to trials in consomm2, and if they do at least 3 times, ask them extra questions in consomm2ih, otherwise jump to consomm3."

The way to do this is to /skip consomm2ih if the condition is not met. I.e. do

<block part_1>
...
/trials = [1-2 = consomm1; 3-9 = consomm2; 10-11 = consomm2hi; 12-15 = consomm3; 16-17 = consomm3ef]
...
</block>

with

<likert consomm2hi>
/ skip = [values.myscore < 3 ]
...
</likert>

#2: Your <list> element's /items attribute is invalid. You need to use (...) not [...]

<list questionlist>
/items = ("Orange, citron, clémentines, pamplemousse", "Prunes, pruneaux", "Courgette, potimarron, ou autre courge", "Salade", "Noix",
"Maquereau", "Sardine ou hareng", "Saumon", "Esturgeon", "Merlu, truite", "Boeuf", "Porc", "Agneau", "Cheval", "Volaille", "Œuf",
"Sucre blanc", "Sucre roux", "Miel", "Confiture", "Pâte à tartiner au chocolat", "Rapadura", "Aspartame", "Huile d'olive",
"Huile de tournesol", "Huile de noix", "Huile de lin", "Huile de bourrache ou onagre", "Huile de soja", "Huile de cameline",
"Huile de colza", "Huile de palme ou coco")
</list>