Millisecond Forums

latency based feedback

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

By Anamaria - 9/17/2012

Hi guys,



I have a question regarding feedback assignment based on participants RTs. For each CSrew trial, I want participants to receive a correct message (+10 & sound) only when they answer correctly (''q'' press) on the CSrew trial & only if their RT is faster than 300 ms. If they answer incorrectly and/or if their RT is slower than 300 ms, I want then to receive no feedback. Also, I want them to receive block feedback that tells participants how many points they won during the current block (the final number of points should be calculated based on the RTs and correct responses to the CSrew trials).


I have attached some parts of my script below.



Any hints would be greatefully received. Thanks in advance.



Ana




++GAMETASK++

<trial CSrew>
/ pretrialpause= 700
/ trialcode = "CSrew"
/ validresponse = ("q", "s")
/ correctresponse = ("q")
/ responsemessage = ("q", correctmessage, 500)
/ responsemessage = ("q", correctnoise, 500)
/ errormessage = (errormessage, 500)
/ responsemode = timeout (1500)
/ stimulustimes = [0= kaderm, CSrew, CSrewS; 100 = eraserm, ?]
/ responseinterrupt = trial
/ posttrialpause= 700
</trial>



<trial CSneu>
/ pretrialpause= 700
/ trialcode = "CSneu"
/ validresponse = ("q", "s")
/ correctresponse = ("s")
/ errormessage = (errormessage, 500)
/ responsemode = timeout (1500)
/ stimulustimes = [0= kaderm, CSneu, CSneuS; 100 = eraserm, ?]
/ responseinterrupt = trial
/ posttrialpause= 700
</trial>



<block intro_gametask>
/ screencolor = (0,0,0)
/ preinstructions = (intro_gametask)
/ trials = [1-12 = random (CSneu, CSrew)]
/ blockfeedback = (meanlatency, correct)
</block>



**Error, ?, Correct, GOAL TASK**


<text ?>
/ numitems = 1
/ items = ("?")
/ color = (255, 0, 0)
/ txbgcolor = (247, 247, 247)
/ position = (50, 50)
/ font = ("Arial Black", -37, 700, 0, 34)
</text>


<text correctmessage>
/ numitems = 1
/ items = (" +10 ")
/ font = ("Arial Black", -107, 700, 0, 34)
/ txbgcolor = (0, 0, 0)
/ position = (50, 50)
/ color = (255, 255, 255)
< /text>



<text errormessage>
/ numitems = 1
/ items = (" FOUT! ")
/ font = ("Arial Black", -107, 700, 0, 34)
/ txbgcolor = (0, 0, 0)
/ position = (50, 50)
/ color = (255, 0, 0)
</text>
By Dave - 9/17/2012

For each CSrew trial, I want participants to receive a correct message (+10 & sound) only when they answer correctly (''q'' press) on the CSrew trial & only if their RT is faster than 300 ms. If they answer incorrectly and/or if their RT is slower than 300 ms


Use the <trial> element's /iscorrectresponse attribute. I.e.


/ iscorrectresponse = [trial.CSrew.response==16 && trial.CSrew.latency < 300]


Also, I want them to receive block feedback that tells participants how many points they won during the current block (the final number of points should be calculated based on the RTs and correct responses to the CSrew trials).


Calculate their points using <values>, <expressions> and conditional logic via /ontrialend, etc. Then display the result via a <trial> element at the end of the block.


Regards,


~Dave


By Anamaria - 9/17/2012

Hi Dave,


Thanks for guiding my steps a little bit. I tried to read the documentation and use the elements you suggested, but I failed abysmally. I have attached the updated script and I would appreciate if you could further help me out or maybe orient my efforts toward a task using similar elements. Thank you.



Ana

<trial CSrew>
/ pretrialpause= 700
/ trialcode = "CSrew"
/ validresponse = ("q", "s")
/ correctresponse = ("q")
/ responsemessage = ("q", correctmessage, 500)
/ responsemessage = ("q", correctnoise, 500)
/ errormessage = (errormessage, 500)
/ responsemode = timeout (1500)
/ stimulustimes = [0= kaderm, CSrew, CSrewS; 100 = eraserm, ?]
/ responseinterrupt = trial
/ posttrialpause= 700
/ iscorrectresponse = [trial.CSrew.response== "q" && trial.CSrew.latency < 300]
/ stimulusframes = [1 = CSrew]
/ ontrialend=[if (trial.CSrew.correct == 1) then values.score = values.score + 10]
</trial>



<values>
/ score = 0
</values>


<text reward>
/ items= ("totalcorrectcount = <% trial.CSrew.totalcorrectcount %>")
</text>

By Dave - 9/17/2012

#1: 'response' returns the keyboard scancode, not the literal key value. See Tools -> Keyboard Scancodes... See the example I posted in my previous reply.


#2: You don't need a correctresponse attribute when you've defined iscorrectresponse.


#3: /responsemessage won't help. Either use /correctmessage or /branch to a separate <trial> to display your feedback stims.

By Anamaria - 9/19/2012

Hi Dave,



I defined an ''iscorrect'' element and deleated the correctresponse element for CSrew trial. Then branched the mean latency < 350 ms. for the current CSrew trial to a another trial that delivers a correctmessage (+10) and a sound.correctnoise. Also, latency > 350 ms was branched to a nopoints message (0). So I am thankful I resolved this part.


However, one problem remains: if I add an errormessage as well for the CSrew trial and i press the correct key''q''it plays the errormessage at the same time with the correctmessage (+10). What I want is to get inquisit play the error message when I press the wrong key ''s''. How could I resolve this?


For instance, for the CSneu trial the error message is played correctly when pressing the wrong key, but for CSneu I use ''correctresponse'' while for CSrew I use ''iscorrectresponse''.


Thanks for helping me out.


Ana


*********************************


<trial  CSneu>
/ pretrialpause= 700
/ trialcode = "CSneu"
/ validresponse = ("q", "s")
/ correctresponse = ("s")
/ errormessage = (errormessage, 500)
/ responsemode = timeout (1500)
/ stimulustimes = [0= kaderm, CSneu, CSneuS; 100 = eraserm, ?]
/ responseinterrupt = trial
/ posttrialpause= 700
</trial>


<trial CSrew>
/ pretrialpause= 700
/ trialcode = "CSrew"
/ validresponse = ("q", "s")
/ errormessage = (errormessage, 500)
/ iscorrectresponse = [trial.CSrew.response== "q" && trial.CSrew.latency < 350]
/ responsemode = timeout (1500)
/ stimulustimes = [0= kaderm, CSrew, CSrewS; 100 = eraserm, ?]
/ responseinterrupt = trial
/ posttrialpause= 700
/ branch=[if (trial.CSrew.meanlatency < 350) trial.points]
/ branch = [if (trial.CSrew.meanlatency > 350) trial.nopoints]
</trial>


<trial points>
/ pretrialpause= 100
/ trialcode = "points"
/ responsemode = timeout (500)
/ stimulustimes = [0=correctmessage, correctnoise]
/ responseinterrupt = trial
/ posttrialpause= 100
</trial>



<trial nopoints>
/ pretrialpause= 100
/ trialcode = "nopoints"
/ responsemode = timeout (500)
/ stimulustimes = [0=nopoints]
/ responseinterrupt = trial
/ posttrialpause= 100
</trial>


By Dave - 9/19/2012

/ iscorrectresponse = [trial.CSrew.response== "q" && trial.CSrew.latency < 350]


Your /iscorrectresponse attribute is unfunctional. As stated previously, you need to use keyboard scancodes if you want to check the response.

By Anamaria - 9/19/2012

Great, I understand it now. However, while using scancodes, the errormessage is still not played correcty. So how can I achieve this? Thanks again.  


<trial CSrew>
/ pretrialpause= 700
/ trialcode = "CSrew"
/ validresponse = ("q", "s")/ errormessage = (errormessage, 500)
/ iscorrectresponse = [trial.CSrew.response== "16" && trial.CSrew.latency < 350]
/ responsemode = timeout (1500)
/ stimulustimes = [0= kaderm, CSrew, CSrewS; 100 = eraserm, ?]
/ responseinterrupt = trial
/ posttrialpause= 700
/ branch=[if (trial.CSrew.meanlatency < 350) trial.points]
/ branch = [if (trial.CSrew.meanlatency > 350) trial.nopoints]
</trial>

By Dave - 9/19/2012

Here is a drastically stripped down version of your code:


<block myblock>
/ trials = [1-10=CSrew]
</block>

<trial CSrew>
/ trialcode = "CSrew"
/ validresponse = ("q", "s")
/ errormessage = (errormessage, 500)
/ iscorrectresponse = [trial.CSrew.response== "16"]
</trial>

<text errormessage>
/ items = ("ERROR")
</text>


Error messages work perfectly fine for me. If they do for you too with this code, you need to re-check your script for mistakes in other places.

By Anamaria - 9/20/2012

Hi Dave,


Thanks, I think I resolved the error feedback.


I have one more question: I defined values and used ontrialend in order to calculate how many points participants win during the task. But I get a message saying that ''value score'' is invalid.I have also defined a text score that is meant to be shown to participants at the end of the block, but I get a message that ''block_introgametask is invalid''. Could you help me understand what is missing? My goal is to get inquisit count the +10 points delivered during the block and then show participants a total score feedback at the end of each block.Thank you again for your patience.


Ana


*****************************************


<values>
/ score=0
</values>



<trial CSrew>
/ pretrialpause= 700
/ trialcode = "CSpun"
/ validresponse = ("q", "s")
/ errormessage = (errormessage, 500)
/ iscorrectresponse = [trial.CSrew.response== "16"]
/ responsemode = timeout (1500)
/ stimulustimes = [0= kaderm, CSrew, CSrewS; 100 = eraserm, ?]
/ responseinterrupt = trial
/ posttrialpause= 700
/ branch=[if (trial.CSrew.meanlatency < 350) trial.points]
/ branch = [if (trial.CSrew.meanlatency > 350) trial.nopoints]
/ ontrialend=[values.score = values.score + 10 * trial.CSrew.correct]
/ ontrialend=[if (trial.CSrew.correct == 1) values.score = values.score + 10]
</trial>



<text score>
/ items = ("Total score: <% block_introgametask %>")
/ position = (50%, 5%)
</text

By Dave - 9/20/2012

I get a message saying that ''value score'' is invalid.


This is presumably due to a typo somewhere in your script. Inspect the element the error message is thrown for.


<text score>
/ items = ("Total score: <% block_introgametask %>")
/ position = (50%, 5%)
</text


This does not make sense. You don't want a <text> element to try and display a <block> element. You want the <text> element to display <%values.score%>, you want a <trial> to present said <text> element and a <block> to run said <trial>.

By Anamaria - 9/20/2012

Hi Dave,



Ok, so now I tried to define those elements according to your advice. If I include two trial attributes inside the block, I receive a warning saying that the trial attribute of the block element is unassigned and could not be located.



<values>
/ score=0
</values>


<text feedback>
/ items= ("value = <% values.score %>")
</text>


<trial feedback>
/ pretrialpause= 300
/ trialcode = "feedback"
/ responsemode = timeout (2500)
/ stimulustimes = [0=feedback]
/ responseinterrupt = trial
/ posttrialpause= 300
</trial>



**********  blocks *************************
<block intro_gametask>
/ screencolor = (0,0,0)
/ preinstructions = (intro_gametask)
/ trials = [1-12 = random (CSneu, CSpun)]
/ trials = [1 = (feedback)]
/ blockfeedback = (meanlatency, correct)
</block>



However, if I include the feedback inside the same trial attribute of the block (see below), the task plays BUT I do not get any feedback score page at the end of the block.



<block intro_gametask>
/ screencolor = (0,0,0)
/ preinstructions = (intro_gametask)
/ trials = [1-12 = random (CSneu, CSpun) feedback]
/ blockfeedback = (meanlatency, correct)
</block>


What important step am I missing? Thank you again.


Ana

By Dave - 9/20/2012

**********  blocks *************************
<block intro_gametask>
/ screencolor = (0,0,0)
/ preinstructions = (intro_gametask)
/ trials = [1-12 = random (CSneu, CSpun)]
/ trials = [1 = (feedback)]

/ blockfeedback = (meanlatency, correct)
</block>


You've defined the /trials attribute twice. That's not allowed. The second definition has invalid syntax, too. See the docs for correct syntax examples.


<block intro_gametask>
/ screencolor = (0,0,0)
/ preinstructions = (intro_gametask)
/ trials = [1-12 = random (CSneu, CSpun) feedback]
/ blockfeedback = (meanlatency, correct)
</block>


The syntax here is also invalid. It should be


/ trials = [1-12 = random (CSneu, CSpun); 13 =  feedback]


obviously. I recommend you revisit the tutorials included in the Inquisit documentation to get more familiar the basic elements and their correct syntax.


Regards,


~Dave

By Anamaria - 9/20/2012

Perfect, I ran the task again and now it displays the score feedback :) Sure, I will study the tutorials more carefully. Thanks a lot for your guidance!


Ana

By Anamaria - 9/20/2012

Hi again Dave,


Uff my happiness did not last long as I have just realized that the score displayed is the sum of scores for all trials, and not only for the trials when participants win 10 points as a result of their fast RTs. So if I run the 12-trial block, I end up with a score of -120, although I have just lost 20 points during the task (as displayed during the trial feedback). So what element shall I use so that the final score displayed sums up only my correct responses during the task and not all my responses? I would appreciate if you can point me in a direction and sorry for bothering you with my beginner questions.


Regards,


Ana

By Dave - 9/20/2012

So what element shall I use so that the final score displayed sums up only my correct responses during the task and not all my responses?


It's not a matter of display. Your calculations must be wrong. Check them.

By Anamaria - 9/23/2012

Hi Dave,


I corrected the calculations and managed to provide paricipants with a block feedback about their score. Now I would like them to receive also a feedback page that  informs them about the total number of points won across the 3 blocks. How can I achieve this? Thank you.


Ana


**********  blocks ****************************



<block test_gametask1>
/ screencolor = (0,0,0)
/ preinstructions = (testfase_gametask1)
/ trials = [1-12 = random (CSneu, CSpun); 13 = feedback]
/ blockfeedback = (meanlatency)
</block>



<block test_gametask2>
/ screencolor = (0,0,0)
/ preinstructions = (testfase_gametask2)
/ trials = [1-12 = random (CSneu, CSpun); 13 = feedback]
/ blockfeedback = (meanlatency)
</block>


<block test_gametask3>
/ screencolor = (0,0,0)
/ preinstructions = (testfase_gametask3)
/ trials = [1-12 = random (CSneu, CSpun); 13 = feedback]
/ blockfeedback = (meanlatency)
</block>


By Dave - 9/23/2012

Now I would like them to receive also a feedback page that  informs them about the total number of points won across the 3 blocks. How can I achieve this? Thank you.


In the same way you provide the per-block feedback. Set up <values>, <text>, <trial> and <block> elements displaying the relevant metrics and run the resulting block after your 3 game blocks.