store correct response based on previous trial


store correct response based on previous trial

Author
Message
lir1995
lir1995
New Member
New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)

Group: Forum Members
Posts: 5, Visits: 29
Hi, 

I am new to Inquisit, and creating a new task that requires participants to determine whether the current item matches with the previous (like playing the game of dominoes, where a domino containing one and two would match to three, one, but not with four, five). I am looking for syntax to store the correct response based on whether the current stimulus matches with the previous. Is there a way to do this? 

Additionally, is there a way to counterbalance my blocks so that half of the trials in the block are "match" trials, and half of the trials are "mismatch" trials. A match trial would mean that the next stimulus contains one of the same numbers as the previous, and mismatch would mean that both of the numbers are different. 

Thank you very much in advance for any help! Let me know if you need additional clarification. 


Dave
Dave
Supreme Being
Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)

Group: Administrators
Posts: 9.9K, Visits: 49K
lir1995 - 11/21/2019
Hi, 

I am new to Inquisit, and creating a new task that requires participants to determine whether the current item matches with the previous (like playing the game of dominoes, where a domino containing one and two would match to three, one, but not with four, five). I am looking for syntax to store the correct response based on whether the current stimulus matches with the previous. Is there a way to do this? 

Additionally, is there a way to counterbalance my blocks so that half of the trials in the block are "match" trials, and half of the trials are "mismatch" trials. A match trial would mean that the next stimulus contains one of the same numbers as the previous, and mismatch would mean that both of the numbers are different. 

Thank you very much in advance for any help! Let me know if you need additional clarification. 


What you're describing is basically similar a 1-back task. You can look at the n-back scripts available in the library for elaborate examples on how to implement something like this. I could give you a more concrete example / some skeleton code, but you would have to spell out the exact matching rules you wish to implement first.

Dave
Dave
Supreme Being
Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)

Group: Administrators
Posts: 9.9K, Visits: 49K
Dave - 11/21/2019
lir1995 - 11/21/2019
Hi, 

I am new to Inquisit, and creating a new task that requires participants to determine whether the current item matches with the previous (like playing the game of dominoes, where a domino containing one and two would match to three, one, but not with four, five). I am looking for syntax to store the correct response based on whether the current stimulus matches with the previous. Is there a way to do this? 

Additionally, is there a way to counterbalance my blocks so that half of the trials in the block are "match" trials, and half of the trials are "mismatch" trials. A match trial would mean that the next stimulus contains one of the same numbers as the previous, and mismatch would mean that both of the numbers are different. 

Thank you very much in advance for any help! Let me know if you need additional clarification. 


What you're describing is basically similar a 1-back task. You can look at the n-back scripts available in the library for elaborate examples on how to implement something like this. I could give you a more concrete example / some skeleton code, but you would have to spell out the exact matching rules you wish to implement first.

Here's a simple example with two different digits between 1 and 9 sampled randomly in each trial. In match trials, one of the previous digits will be kept, the other will be replaced with a different one. In mismatch trials, both previous digits will be replaced with different ones.

<trial start>
/ ontrialbegin = [
values.n1 = list.numbers.nextvalue;
values.n2 = list.numbers.nextvalue;
]
/ stimulusframes = [1=number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("n")
</trial>

<trial match>
/ ontrialbegin = [
list.numbers.reset();
values.matchposition = replace(1,2);
if (values.matchposition == 1) {
values.not1 = values.n1;
values.not2 = values.n2;
values.n2 = list.numbers.nextvalue;
} else if (values.matchposition == 2) {
values.not1 = values.n1;
values.not2 = values.n2;
values.n1 = list.numbers.nextvalue;
}
]
/ stimulusframes = [1=number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("y")
</trial>

<trial mismatch>
/ ontrialbegin = [
list.numbers.reset();
values.not1 = values.n1;
values.not2 = values.n2;
values.matchposition = 0;
values.n1 = list.numbers.nextvalue;
values.n2 = list.numbers.nextvalue;
]
/ stimulusframes = [1=number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("n")
</trial>

<block example>
/ trials = [1= start; 2-21 = noreplace(match, mismatch)]
</block>

<text number_one>
/ items = ("<%values.n1%>")
/ position = (48%, 50%)
</text>

<text number_two>
/ items = ("<%values.n2%>")
/ position = (52%, 50%)
</text>

<values>
/ n1 = 0
/ n2 = 0
/ matchposition = 0
/ not1 = 0
/ not2 = 0
</values>

<list numbers>
/ items = (1,2,3,4,5,6,7,8,9)
/ replace = false
/ selectionrate = always
/ not = (values.not1)
/ not = (values.not2)
</list>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.n1 values.n2 values.matchposition)
/ separatefiles = true
</data>


lir1995
lir1995
New Member
New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)

Group: Forum Members
Posts: 5, Visits: 29
This was very helpful, thanks!
lir1995
lir1995
New Member
New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)

Group: Forum Members
Posts: 5, Visits: 29
Thank you so much again for your help! I have been working on adapting the code you sent to work with images. I will have one image on top of the other. The number of dots in each image will either match or non match. 

Is this even possible? I have attached the code I have been working with as well as the data file. 


<trial start>
/ stimulustimes = [0=box,number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("n")
/ ontrialbegin = [
values.n1 = picture.number_one.nextvalue;
values.n2 = picture.number_two.nextvalue;]
</trial>

<trial match>
/ ontrialbegin = [
list.dominoes.reset();
values.matchposition = replace(1,2);
if (values.matchposition == 1) {
values.not1 = values.n1;
values.not2 = values.n2;
values.n2 = picture.number_two.nextvalue;
} else if (values.matchposition == 2) {
values.not1 = values.n1;
values.not2 = values.n2;
values.n1 = picture.number_one.nextvalue;
}
]
/ stimulustimes = [0=box,number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("y")
/ ontrialend = [
values.not1 = picture.mismatch1.nextvalue;
values.not2 = picture.mismatch2.nextvalue;
]
</trial>

<trial mismatch>
/ ontrialbegin = [
list.dominoes.reset();
values.not1 = values.n1;
values.not2 = values.n2;
values.matchposition = 0;
values.n1 = picture.number_one.nextvalue;
values.n2 = picture.number_two.nextvalue;
]
/ stimulustimes = [0=box,number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("n")
/ ontrialend = [
values.not1 = picture.mismatch1.nextvalue;
values.not2 = picture.mismatch2.nextvalue
]
</trial>

<block example>
/ trials = [1= start; 2-21 = noreplace(match, mismatch)]
</block>


<values>
/ n1 = 0
/ n2 = 0
/ matchposition = 0
/ not1 = 0
/ not2 = 0
</values>


<picture domino>
/ items = domino
/ size = (50%, 50%)
/ erase = false
</picture>

<item domino>
/1 = "1.png"
/2 = "2.png"
/3 = "3.png"
/4 = "4.png"
/6 = "5.png"
/6 = "6.png"
</item>

<picture number_one>
/ items = domino
/ position = (50%, 68%)
/ select = replace
</picture>

<picture number_two>
/ items = domino
/ position = (50%, 32%)
/ select = replace
</picture>


<picture box>
/ items = box
/ size = (55%, 55%)
/ erase = false
</picture>

<item box>
/1 = "dominostim/box.png"
</item>


<list dominoes>
/ items = (1,2,3,4,5,6)
/ replace = false
/ selectionrate = always
/ not = (values.not1)
/ not = (values.not2)
</list>


<list not1>
/ items = (1,2,3,4,5,6)
/ not = (values.n1)
/ replace = true
</list>

<list not2>
/ items = (1,2,3,4,5,6)
/ not = (values.n2)
/ replace = true
</list>

<picture mismatch1>
/ items = domino
/ select = list.not1.nextvalue
/size = (40%, 40%)
</picture>

<picture mismatch2>
/ items = domino
/ select = list.not2.nextvalue
/size = (40%, 40%)
</picture>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.n1 values.n2 values.matchposition stimulusitem stimulusitem stimulusitem values.not1)
/ separatefiles = true
</data>

Thank you very much, and again happy to clarify!
Attachments
Dave
Dave
Supreme Being
Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)Supreme Being (749K reputation)

Group: Administrators
Posts: 9.9K, Visits: 49K
lir1995 - 11/23/2019
Thank you so much again for your help! I have been working on adapting the code you sent to work with images. I will have one image on top of the other. The number of dots in each image will either match or non match. 

Is this even possible? I have attached the code I have been working with as well as the data file. 


<trial start>
/ stimulustimes = [0=box,number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("n")
/ ontrialbegin = [
values.n1 = picture.number_one.nextvalue;
values.n2 = picture.number_two.nextvalue;]
</trial>

<trial match>
/ ontrialbegin = [
list.dominoes.reset();
values.matchposition = replace(1,2);
if (values.matchposition == 1) {
values.not1 = values.n1;
values.not2 = values.n2;
values.n2 = picture.number_two.nextvalue;
} else if (values.matchposition == 2) {
values.not1 = values.n1;
values.not2 = values.n2;
values.n1 = picture.number_one.nextvalue;
}
]
/ stimulustimes = [0=box,number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("y")
/ ontrialend = [
values.not1 = picture.mismatch1.nextvalue;
values.not2 = picture.mismatch2.nextvalue;
]
</trial>

<trial mismatch>
/ ontrialbegin = [
list.dominoes.reset();
values.not1 = values.n1;
values.not2 = values.n2;
values.matchposition = 0;
values.n1 = picture.number_one.nextvalue;
values.n2 = picture.number_two.nextvalue;
]
/ stimulustimes = [0=box,number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("n")
/ ontrialend = [
values.not1 = picture.mismatch1.nextvalue;
values.not2 = picture.mismatch2.nextvalue
]
</trial>

<block example>
/ trials = [1= start; 2-21 = noreplace(match, mismatch)]
</block>


<values>
/ n1 = 0
/ n2 = 0
/ matchposition = 0
/ not1 = 0
/ not2 = 0
</values>


<picture domino>
/ items = domino
/ size = (50%, 50%)
/ erase = false
</picture>

<item domino>
/1 = "1.png"
/2 = "2.png"
/3 = "3.png"
/4 = "4.png"
/6 = "5.png"
/6 = "6.png"
</item>

<picture number_one>
/ items = domino
/ position = (50%, 68%)
/ select = replace
</picture>

<picture number_two>
/ items = domino
/ position = (50%, 32%)
/ select = replace
</picture>


<picture box>
/ items = box
/ size = (55%, 55%)
/ erase = false
</picture>

<item box>
/1 = "dominostim/box.png"
</item>


<list dominoes>
/ items = (1,2,3,4,5,6)
/ replace = false
/ selectionrate = always
/ not = (values.not1)
/ not = (values.not2)
</list>


<list not1>
/ items = (1,2,3,4,5,6)
/ not = (values.n1)
/ replace = true
</list>

<list not2>
/ items = (1,2,3,4,5,6)
/ not = (values.n2)
/ replace = true
</list>

<picture mismatch1>
/ items = domino
/ select = list.not1.nextvalue
/size = (40%, 40%)
</picture>

<picture mismatch2>
/ items = domino
/ select = list.not2.nextvalue
/size = (40%, 40%)
</picture>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.n1 values.n2 values.matchposition stimulusitem stimulusitem stimulusitem values.not1)
/ separatefiles = true
</data>

Thank you very much, and again happy to clarify!

Of course it's possible. Just use values.n1 and values.n2 to select the item in the <picture> elements, i.e.

/ select = values.n1

and

/ select = values.n2

respectively.

<trial start>
/ ontrialbegin = [
values.n1 = list.numbers.nextvalue;
values.n2 = list.numbers.nextvalue;
]
/ stimulusframes = [1=number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("n")
</trial>

<trial match>
/ ontrialbegin = [
list.numbers.reset();
values.matchposition = replace(1,2);
if (values.matchposition == 1) {
values.not1 = values.n1;
values.not2 = values.n2;
values.n2 = list.numbers.nextvalue;
} else if (values.matchposition == 2) {
values.not1 = values.n1;
values.not2 = values.n2;
values.n1 = list.numbers.nextvalue;
}
]
/ stimulusframes = [1=number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("y")
</trial>

<trial mismatch>
/ ontrialbegin = [
list.numbers.reset();
values.not1 = values.n1;
values.not2 = values.n2;
values.matchposition = 0;
values.n1 = list.numbers.nextvalue;
values.n2 = list.numbers.nextvalue;
]
/ stimulusframes = [1=number_one, number_two]
/ validresponse = ("y", "n")
/ correctresponse = ("n")
</trial>

<block example>
/ trials = [1= start; 2-21 = noreplace(match, mismatch)]
</block>

<picture number_one>
/ items = domino
/ position = (50%, 32%)
/ select = values.n1
</picture>

<picture number_two>
/ items = domino
/ position = (50%, 68%)
/ select = values.n2
</picture>

<item domino>
/1 = "1.png"
/2 = "2.png"
/3 = "3.png"
/4 = "4.png"
/6 = "5.png"
/6 = "6.png"
</item>

<values>
/ n1 = 0
/ n2 = 0
/ matchposition = 0
/ not1 = 0
/ not2 = 0
</values>

<list numbers>
/ items = (1,2,3,4,5,6)
/ replace = false
/ selectionrate = always
/ not = (values.not1)
/ not = (values.not2)
</list>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode response latency correct values.n1 values.n2 values.matchposition)
/ separatefiles = true
</data>

lir1995
lir1995
New Member
New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)New Member (35 reputation)

Group: Forum Members
Posts: 5, Visits: 29
Ah, I see. Thank you very much!!
GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search