Millisecond Forums

N-back Task non-adaptive. How to control answers

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

By MWirth - 8/19/2015

Hello

I am currently working on a non-adaptive N-back task and want to check if the test subject has given the correct answer. But different to the original N-back task the test subject has to answer with the position of a figure N trials before instead of just checking if the figure is the same.
The programm shows always the same blue square but in different positions: top-left, top-right, bottom-left, bottom-right. The test subject than has to tip the positions of the square 2 or 3 trials before into the keyboard:

W --> (17) --> top-left
O --> (24) --> top-right
A --> (30) --> bottom-left
L --> (38) --> bottom-right

By now, this is the code i have:

Pictures:
<picture Nback_trainingsquare1Selection>
/ items = Nback_trainingsquare1
/select = 1
/size = (100%, 100%)
</picture>

-->the same for the other 3 square-pictures

Trials:
<trial training1>
/ stimulustimes = [0 = Nback_trainingsquare1Selection; 0 = Abbruch; 500 = erasertraining; 500 = Abbruch;]
/ validresponse = (noresponse, 30, 38, 17, 24)
/ responsetime = 0
/trialduration = 2500
</trial>

--> the same for the other three suares

Block, 2-Back:
<block TrainingOld_2back_Nr1>
/ onblockbegin = [ values.N = 2;
values.currenttarget = 0; values.minus1 = 0; values.minus2 = 0; values.minus3 = 0; values.minus4 = 0;
values.TotalBlocks = values.TotalBlocks + 1;
values.starttrialcounter = 0;
values.repetitioncounter = values.repetitioncounter + 1;
]
/ trials = [1 - 121 = noreplace(training1, training2, training3, training4)]
/ screencolor = (0, 0, 0)
/ skip = [radiobuttons.agegroup.response!="2"]
</block>


Block, 3-Back:
<block TrainingYoung_3back_Nr1>
/ onblockbegin = [ values.N = 3;
values.currenttarget = 0; values.minus1 = 0; values.minus2 = 0; values.minus3 = 0; values.minus4 = 0;
values.TotalBlocks = values.TotalBlocks + 1;
values.starttrialcounter = 0;
values.repetitioncounter = values.repetitioncounter + 1;
]
/ trials = [1 - 121 = noreplace(training1, training2, training3, training4)]
/ screencolor = (0, 0, 0)
/ skip = [radiobuttons.agegroup.response!="1"]


I hope that someone can help me, thank you! :)

By Dave - 8/19/2015

You use the <trial> element's /iscorrectresponse attribute to check the given response for correctness. I.e. store the position of the stimulus (square) n positions back in a variable, then evaluate whether the given response matches the position stored in that variable.
By Dave - 8/19/2015

Perhaps a small example will help to clarify what I mean:

<values>
/ n = 1
/ 1back = 0
/ 2back = 0
/ 3back = 0
/ correctkey = 0
</values>

<expt>
/ blocks = [1=2back; 2=3back]
</expt>

<block 2back>
/ onblockbegin = [values.n = 2]
/ trials = [1-100=noreplace(t1,t2,t3,t4)]
</block>

<block 3back>
/ onblockbegin = [values.n = 3]
/ trials = [1-100=noreplace(t1,t2,t3,t4)]
</block>

<trial t1>
/ ontrialbegin = [values.correctkey=0; ]
/ ontrialbegin = [if (values.n==2 && values.2back==17) values.correctkey = values.2back;]
/ ontrialbegin = [if (values.n==3 && values.3back==17) values.correctkey = values.3back;]
/ ontrialend = [values.3back=values.2back; values.2back=values.1back; values.1back=17;]
/ stimulusframes = [1=topleft, debug]
/ validresponse = (30, 38, 17, 24, 0)
/ iscorrectresponse = [trial.t1.response == values.correctkey]
/ timeout = 2500
</trial>

<trial t2>
/ ontrialbegin = [values.correctkey=0; ]
/ ontrialbegin = [if (values.n==2 && values.2back==24) values.correctkey = values.2back;]
/ ontrialbegin = [if (values.n==3 && values.3back==24) values.correctkey = values.3back;]
/ ontrialend = [values.3back=values.2back; values.2back=values.1back; values.1back=24;]
/ stimulusframes = [1=topright, debug]
/ validresponse = (30, 38, 17, 24, 0)
/ iscorrectresponse = [trial.t2.response == values.correctkey]
/ timeout = 2500
</trial>

<trial t3>
/ ontrialbegin = [values.correctkey=0; ]
/ ontrialbegin = [if (values.n==2 && values.2back==30) values.correctkey = values.2back;]
/ ontrialbegin = [if (values.n==3 && values.3back==30) values.correctkey = values.3back;]
/ ontrialend = [values.3back=values.2back; values.2back=values.1back; values.1back=30;]
/ stimulusframes = [1=bottomleft, debug]
/ validresponse = (30, 38, 17, 24, 0)
/ iscorrectresponse = [trial.t3.response == values.correctkey]
/ timeout = 2500
</trial>

<trial t4>
/ ontrialbegin = [values.correctkey=0; ]
/ ontrialbegin = [if (values.n==2 && values.2back==38) values.correctkey = values.2back;]
/ ontrialbegin = [if (values.n==3 && values.3back==38) values.correctkey = values.3back;]
/ ontrialend = [values.3back=values.2back; values.2back=values.1back; values.1back=38;]
/ stimulusframes = [1=bottomright, debug]
/ validresponse = (30, 38, 17, 24, 0)
/ iscorrectresponse = [trial.t4.response == values.correctkey]
/ timeout = 2500
</trial>

<shape topleft>
/ shape = rectangle
/ color = blue
/ size = (100px, 100px)
/ position = (10%, 10%)
</shape>

<shape topright>
/ shape = rectangle
/ color = blue
/ size = (100px, 100px)
/ position = (10%, 90%)
</shape>

<shape bottomleft>
/ shape = rectangle
/ color = blue
/ size = (100px, 100px)
/ position = (10%, 90%)
</shape>

<shape bottomright>
/ shape = rectangle
/ color = blue
/ size = (100px, 100px)
/ position = (90%, 90%)
</shape>

<text debug>
/ items = ("Key to press in this trial: <%values.correctkey%> ~nN-level=<%values.n%> ~n1-back=<%values.1back%> | 2-back=<%values.2back%> | 3-back=<%values.3back%>")
/ erase = false
/ size = (50%, 25%)
/ valign = center
</text>

I.e. a subject has to respond with a certain key *if* the position of the square in the *current trial* matches the position of the square either 2 (2-back block) or 3 (3-back block) trials before. At least that's how I read your original description.
By MWirth - 8/23/2015

Hello 

Thank you for your quick help. Now I have an idea how to use the element iscorrectrespons. But I think maybe you misunderstood my description of the needed answers, I'haven't described it clear enough.I'm sorry about that. You wrote:

"I.e. a subject has to respond with a certain key *if* the position of the square in the *current trial* matches the position of the square either 2 (2-back block) or 3 (3-back block) trials before. At least that's how I read your original description."

But the test subject has to give an answer every trial, not only if the square is in the same position as the square 2 or 3 trials back. I'll give you a an example:

2-Back: "Give the position of the square 2 trials before"

1. Trial: Picture= Bottom left / Correct Answer= no response (Because there isn't a square 2 trials before)
2. Trial: Picture= Top right / Correct Answer= no response (Because there isn't a square 2 trials before)
3. Trial: Picture = Bottom right/ Correct Answer=  key "A" or Nr. 30 for Inquisit (Because in the first trial, the square was at the position "bottom left")
4. Trial: Picture= Top left / Correct Answer= key "O" or Nr. 24 for Inquisit (Because in the second trial, the square was at the position "top right")

and so forth.....


By Dave - 8/23/2015

Then that's even easier:

<values>
/ n = 1
/ 1back = 0
/ 2back = 0
/ 3back = 0
/ correctkey = 0
</values>

<expt>
/ blocks = [1=2back; 2=3back]
</expt>

<block 2back>
/ onblockbegin = [values.1back=0; values.2back=0; values.3back=0; ]
/ onblockbegin = [values.n = 2]
/ trials = [1-100=noreplace(t1,t2,t3,t4)]
</block>

<block 3back>
/ onblockbegin = [values.1back=0; values.2back=0; values.3back=0; ]
/ onblockbegin = [values.n = 3]
/ trials = [1-100=noreplace(t1,t2,t3,t4)]
</block>

<trial t1>
/ ontrialbegin = [values.correctkey=0; ]
/ ontrialbegin = [if (values.n==2) values.correctkey = values.2back;]
/ ontrialbegin = [if (values.n==3) values.correctkey = values.3back;]
/ ontrialend = [values.3back=values.2back; values.2back=values.1back; values.1back=17;]
/ stimulusframes = [1=topleft, debug]
/ validresponse = (30, 38, 17, 24, 0)
/ iscorrectresponse = [trial.t1.response == values.correctkey]
/ timeout = 2500
</trial>

<trial t2>
/ ontrialbegin = [if (values.n==2) values.correctkey = values.2back;]
/ ontrialbegin = [if (values.n==3) values.correctkey = values.3back;]
/ ontrialend = [values.3back=values.2back; values.2back=values.1back; values.1back=24;]
/ stimulusframes = [1=topright, debug]
/ validresponse = (30, 38, 17, 24, 0)
/ iscorrectresponse = [trial.t2.response == values.correctkey]
/ timeout = 2500
</trial>

<trial t3>
/ ontrialbegin = [if (values.n==2) values.correctkey = values.2back;]
/ ontrialbegin = [if (values.n==3) values.correctkey = values.3back;]
/ ontrialend = [values.3back=values.2back; values.2back=values.1back; values.1back=30;]
/ stimulusframes = [1=bottomleft, debug]
/ validresponse = (30, 38, 17, 24, 0)
/ iscorrectresponse = [trial.t3.response == values.correctkey]
/ timeout = 2500
</trial>

<trial t4>
/ ontrialbegin = [if (values.n==2) values.correctkey = values.2back;]
/ ontrialbegin = [if (values.n==3) values.correctkey = values.3back;]
/ ontrialend = [values.3back=values.2back; values.2back=values.1back; values.1back=38;]
/ stimulusframes = [1=bottomright, debug]
/ validresponse = (30, 38, 17, 24, 0)
/ iscorrectresponse = [trial.t4.response == values.correctkey]
/ timeout = 2500
</trial>

<shape topleft>
/ shape = rectangle
/ color = blue
/ size = (100px, 100px)
/ position = (10%, 10%)
</shape>

<shape topright>
/ shape = rectangle
/ color = blue
/ size = (100px, 100px)
/ position = (10%, 90%)
</shape>

<shape bottomleft>
/ shape = rectangle
/ color = blue
/ size = (100px, 100px)
/ position = (10%, 90%)
</shape>

<shape bottomright>
/ shape = rectangle
/ color = blue
/ size = (100px, 100px)
/ position = (90%, 90%)
</shape>

<text debug>
/ items = ("Key to press in this trial: <%values.correctkey%> ~nN-level=<%values.n%> ~n1-back=<%values.1back%> | 2-back=<%values.2back%> | 3-back=<%values.3back%>")
/ erase = false
/ size = (50%, 25%)
/ valign = center
</text>