Multiple consequences in conditional branching


Author
Message
Maddy
Maddy
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 7, Visits: 45
Dear all,

Currently, I am programming a task in InQuisit in which participants will first see a fixation cross, then a prime and then complete a reaction time task. In general, these primes are shown randomly. However, in case a participant makes an incorrect response on the reaction time task, one particular prime should appear in the next trial. The amount of different trials in which this particular prime appears is 4, and thus one of them should follow up the incorrect trial. 

Therefore, I am wondering whether it is possible to program an if-then statement in InQuisit which has multiple 'consequences'. In words, I want it to look like this:

IF incorrect response THEN either trial1 or trial2 or trial3 or trial4


Of course, I want InQuisit to randomly select which of these four trials will be run. 

So, basically my question is: how should this be done? And is it even possible?

I really hope you understand my question and can help me.


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Set up a <counter> element containing the numbers 1 to 4, set it to sample randomly (either with or without replacement). In case of an incorrect response, sample a value from the counter. /branch to the trial corresponding to the randomly drawn number.

<values>
/ incorrectresponsetrial = 0
</values>

<counter incorrectresponsetrialcounter>
/ items = (1,2,3,4)
/ select = replace
</counter>

<trial sometrial>
/ validresponse = ("e", "i")
/ correctresponse = ("i")
/ ontrialbegin = [values.incorrectresponsetrial = 0]
/ ontrialend = [if (trial.sometrial.error) values.incorrectresponsetrial = counter.incorrectresponsetrialcounter.selectedvalue]
/ branch = [if (values.incorrectresponsetrial == 1) trial.trial1]
/ branch = [if (values.incorrectresponsetrial == 2) trial.trial2]
/ branch = [if (values.incorrectresponsetrial == 3) trial.trial3]
/ branch = [if (values.incorrectresponsetrial == 4) trial.trial4]
</trial>

Edited 8 Years Ago by Dave
Maddy
Maddy
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 7, Visits: 45
Okay, so the solution suggested by Dave worked quite well (thanks for that!). However, I want my block to be 120 trials long, regardless of how well or how badly a participant performs. In the current situation, each trial that is run because the participant made an incorrect response is added to the total number of trials (so if a participants makes 5 mistakes, the block is 120 + 5 trials long). How can I do this?

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Set up a <values> entry that counts the number of trials. In crease that value in every <trial> element /ontrialend.

<values>
/ trialcount = 0
...
</values>

<trial sometrial>
...
/ ontrialend = [values.trialcount = values.trialcount +1; ]
...
</trial>

<trial trial1>
...
/ ontrialend = [values.trialcount = values.trialcount +1; ]
...
</trial>

...
<trial trial4>
...
/ ontrialend = [values.trialcount = values.trialcount +1; ]
...
</trial>

Set up a /stop condition in the <block> that terminates the block once the value reaches 120:

<block someblock>
/ stop = [values.trialcount >= 120]
...
</block>

Maddy
Maddy
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 7, Visits: 45
Thank you very much. I have tried this code and it most definitely works very well. The only problem is that the trials that should appear when a participant makes an erroneous mistake will now be overrepresented.

For example, I want my experiment to be 60 trials long. 20 of these should be of type trial1, 20 should be of type trial2 and 20 should be of type trial3. Whenever a participants makes a mistake, the following trial will always be of type trial3, but I still want this trial to be presented 20 times in total (unless a participants makes more than 20 mistakes of course, but this is unlikely). Is this possible?


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Since you cannot possibly know (a) how many mistakes someone will make and (b) which trial will be invoked in response to a mistake (since you want that to be random), no, I do not think this is possible.

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
The best you can do is something like this, which may get you close *under the condition that the subject does not make an excessive amount of mistakes*:

<values>
/ n_a_trials = 0
/ n_b_trials = 0
/ n_c_trials = 0
/ incorrectresponsetrial = 0
</values>

<block myblock>
/ stop = [values.n_a_trials + values.n_b_trials + values.n_c_trials >= 30]
/ trials = [1-30 = noreplace(a,b,c)]
</block>

*** regular trials ***
<trial a>
/ ontrialbegin = [values.incorrectresponsetrial = 0]
/ ontrialend = [values.n_a_trials = values.n_a_trials + 1]
/ ontrialend = [if (trial.a.error) values.incorrectresponsetrial = counter.incorrectresponsetrialcounter.selectedvalue]
/ stimulusframes = [1=mytext]
/ validresponse = ("e", "i")
/ correctresponse = ("i")
/ branch = [if (values.incorrectresponsetrial == 1) trial.c_e1]
/ branch = [if (values.incorrectresponsetrial == 2) trial.c_e2]
/ branch = [if (values.incorrectresponsetrial == 3) trial.c_e3]
/ branch = [if (values.incorrectresponsetrial == 4) trial.c_e4]
</trial>

<trial b>
/ ontrialbegin = [values.incorrectresponsetrial = 0]
/ ontrialend = [values.n_b_trials = values.n_b_trials + 1]
/ ontrialend = [if (trial.b.error) values.incorrectresponsetrial = counter.incorrectresponsetrialcounter.selectedvalue]
/ stimulusframes = [1=mytext]
/ validresponse = ("e", "i")
/ correctresponse = ("i")
/ branch = [if (values.incorrectresponsetrial == 1) trial.c_e1]
/ branch = [if (values.incorrectresponsetrial == 2) trial.c_e2]
/ branch = [if (values.incorrectresponsetrial == 3) trial.c_e3]
/ branch = [if (values.incorrectresponsetrial == 4) trial.c_e4]
</trial>

<trial c>
/ skip = [values.n_c_trials >= 10]
/ ontrialbegin = [values.incorrectresponsetrial = 0]
/ ontrialend = [values.n_c_trials = values.n_c_trials + 1]
/ ontrialend = [if (trial.c.error) values.incorrectresponsetrial = counter.incorrectresponsetrialcounter.selectedvalue]
/ stimulusframes = [1=mytext]
/ validresponse = ("e", "i")
/ correctresponse = ("i")
/ branch = [if (values.incorrectresponsetrial == 1) trial.c_e1]
/ branch = [if (values.incorrectresponsetrial == 2) trial.c_e2]
/ branch = [if (values.incorrectresponsetrial == 3) trial.c_e3]
/ branch = [if (values.incorrectresponsetrial == 4) trial.c_e4]
</trial>

<counter incorrectresponsetrialcounter>
/ items = (1,2,3,4)
/ select = replace
</counter>

*** error trials ***
<trial c_e1>
/ ontrialbegin = [values.incorrectresponsetrial = 0]
/ ontrialend = [values.n_c_trials = values.n_c_trials + 1]
/ ontrialend = [if (trial.c_e1.error) values.incorrectresponsetrial = counter.incorrectresponsetrialcounter.selectedvalue]
/ stimulusframes = [1=mytext]
/ validresponse = ("e", "i")
/ correctresponse = ("i")
/ branch = [if (values.incorrectresponsetrial == 1) trial.c_e1]
/ branch = [if (values.incorrectresponsetrial == 2) trial.c_e2]
/ branch = [if (values.incorrectresponsetrial == 3) trial.c_e3]
/ branch = [if (values.incorrectresponsetrial == 4) trial.c_e4]
</trial>

<trial c_e2>
/ ontrialbegin = [values.incorrectresponsetrial = 0]
/ ontrialend = [values.n_c_trials = values.n_c_trials + 1]
/ ontrialend = [if (trial.c_e2.error) values.incorrectresponsetrial = counter.incorrectresponsetrialcounter.selectedvalue]
/ stimulusframes = [1=mytext]
/ validresponse = ("e", "i")
/ correctresponse = ("i")
/ branch = [if (values.incorrectresponsetrial == 1) trial.c_e1]
/ branch = [if (values.incorrectresponsetrial == 2) trial.c_e2]
/ branch = [if (values.incorrectresponsetrial == 3) trial.c_e3]
/ branch = [if (values.incorrectresponsetrial == 4) trial.c_e4]
</trial>

<trial c_e3>
/ ontrialbegin = [values.incorrectresponsetrial = 0]
/ ontrialend = [values.n_c_trials = values.n_c_trials + 1]
/ ontrialend = [if (trial.c_e3.error) values.incorrectresponsetrial = counter.incorrectresponsetrialcounter.selectedvalue]
/ stimulusframes = [1=mytext]
/ validresponse = ("e", "i")
/ correctresponse = ("i")
/ branch = [if (values.incorrectresponsetrial == 1) trial.c_e1]
/ branch = [if (values.incorrectresponsetrial == 2) trial.c_e2]
/ branch = [if (values.incorrectresponsetrial == 3) trial.c_e3]
/ branch = [if (values.incorrectresponsetrial == 4) trial.c_e4]
</trial>

<trial c_e4>
/ ontrialbegin = [values.incorrectresponsetrial = 0]
/ ontrialend = [values.n_c_trials = values.n_c_trials + 1]
/ ontrialend = [if (trial.c_e4.error) values.incorrectresponsetrial = counter.incorrectresponsetrialcounter.selectedvalue]
/ stimulusframes = [1=mytext]
/ validresponse = ("e", "i")
/ correctresponse = ("i")
/ branch = [if (values.incorrectresponsetrial == 1) trial.c_e1]
/ branch = [if (values.incorrectresponsetrial == 2) trial.c_e2]
/ branch = [if (values.incorrectresponsetrial == 3) trial.c_e3]
/ branch = [if (values.incorrectresponsetrial == 4) trial.c_e4]
</trial>

<text mytext>
/ items = ("<%script.currenttrial%> | n(a)=<%values.n_a_trials%> |  n(b)=<%values.n_b_trials%> |  n(c)=<%values.n_c_trials%>")
</text>

<data>
/ columns = [date time subject trialnum trialcode response correct values.n_a_trials values.n_b_trials values.n_c_trials]
/ separatefiles = true
</data>

Edited 8 Years Ago by Dave
Maddy
Maddy
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 7, Visits: 45
Hm so it is not possible to make a pool of, in this case, 20 trials of trialtype 3 and then tell InQuisit to randomly draw a trial from this pool (without replacing it) when an incorrect response is made or when the randomization process determines the next trial should be of this trialtype? This would probably lead to less trials of trialtype3 to be 'spontaneously' initiated by InQuisit but it could still lead to having a total of 20 trials of trialtype3 administered..? Of course, if a person would make more than 20 errors this would not be true but based on previous results I do not expect the error rates to be that high. Am I making a thought error here? It would be great if you could clear things up for me.

Maddy
Maddy
Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)Expert (1.4K reputation)
Group: Forum Members
Posts: 7, Visits: 45
Sorry I did not see your answer before replying to your previous post!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic
1 active, 1 guest, 0 members, 0 anonymous
No members currently viewing this topic!

Explore
Messages
Mentions
Search