Expression for Continuous Feedback?


Author
Message
***JayD***
***JayD***
Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)
Group: Forum Members
Posts: 17, Visits: 67
Hi all,

I'm currently writing a script on Inquisit 3.0 in which participants' eye-movements determine task flow. Specifically, where they look determines whether they are correct or not and how fast they look in the correct place determines how many points they receive (which they are shown on screen after every trial).

Initially, we were going to simply use a reaction time (RT) cut-off/categorical approach (e.g. / branch = [if (trial.16.latency < 250) trial.01]; / branch = [if (trial.16.latency < 500) trial.02] etc.) but now we want to try to determine RT and thus feedback continuously (i.e. from 1-4200 ms).

Further, we would like to build into this continuous feedback a cut-off at 1000ms, RTs over which participants receive no points. Finally, some trials will be "low reward" and others "high reward" - the points received in the former will necessarily be lower than in the latter, even when RT is identical.

The calculation will be (1000 - RT) x 0.002 x reward trial type (1 OR 10).

I have never programmed anything like this before so am unsure how to do it (or even whether it can be done on Inquisit!) but have heard that expressions may be the way to go? If so, how exactly might it look in the script?

I appreciate any help and advice any of you can give.

Thanks,
Jay



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: 103K
You'll want to do something along the following lines:

<values>
/ highreward = 10
/ lowreward = 1
/ reward = 0
/ rt = 0
/ trialscore = 0
/ totalscore = 0
</values>

<expressions>
/ calcreward = max(0, (1000 - values.rt)*0.002*values.reward)
</expressions>

<block myblock>
/ trials = [1-10 = noreplace(highrewardtrial, lowrewardtrial)]
</block>

<trial highrewardtrial>
/ stimulusframes = [1=mytext]
/ ontrialbegin = [values.reward = values.highreward]
/ ontrialend = [values.rt = trial.highrewardtrial.latency;
    values.trialscore = expressions.calcreward;
    values.totalscore = values.totalscore + expressions.calcreward]
/ validresponse = (57)
/ branch = [trial.feedbacktrial]
</trial>

<trial lowrewardtrial>
/ stimulusframes = [1=mytext]
/ ontrialbegin = [values.reward = values.lowreward]
/ ontrialend = [values.rt = trial.lowrewardtrial.latency;
    values.trialscore = expressions.calcreward;
    values.totalscore = values.totalscore + expressions.calcreward]
/ validresponse = (57)
/ branch = [trial.feedbacktrial]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=fbtext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%script.currenttrial%>")
</text>

<text fbtext>
/ items = ("RT: <%values.rt%> | Trial Score: <%values.trialscore%> | Total Score: <%values.totalscore%>")
</text>


***JayD***
***JayD***
Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)
Group: Forum Members
Posts: 17, Visits: 67
That's fantastic - Thanks a lot Dave!

Best,

Jay

***JayD***
***JayD***
Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)
Group: Forum Members
Posts: 17, Visits: 67
Hi Dave,

I used your last response to allow for continuous feedback in one of my tasks and it worked perfectly.

However, I have just tried to apply the same example script you sent on another (very similar) script and Inquisit keeps giving me error messages.

Here is some of the script for the task in which the feedback works:

******************************************************** VALUES & EXPRESSIONS ********************************************************

<values>

/ highreward = 10

/ lowreward = 1

/ reward = 0

/ RT = 0

/ points = 0

/ totalscore = 0

</values>

<expressions>

/ calculatereward = max (0, (1000 - values.RT) * 0.002 * values.reward)

</expressions>

************************************************ TRIALS **********************************************

*********************** FEEDBACK ***********************

<trial feedbacktrial>

/ stimulusframes = [1 = FBtext]

/ response = timeout (1000)

/ recorddata = false

</trial>

<text FBtext>

/ items = ("Correct! You win <%values.points%> MONEY points")

/ fontstyle = ("Arial", 4.79%, false, false, false, false, 5, 0)

/ position = (50,50)

/ color = (0, 255, 0)

/ txbgcolor = (0, 0, 0)

</text>

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

<trial 999>

/ stimulusframes = [1=error]

/ response = timeout (1000)

/ recorddata = false

</trial>

<text error>

/ fontstyle = ("Arial", 4.79%, false, false, false, false, 5, 0)

/ items = ("Incorrect! You lose 5 MONEY points")

/ position = (50,50)

/ color = (255, 0, 0)

/ txbgcolor = (0, 0, 0)

</text>

********************************************************* HD (RED) TRIALS ************************************************

************************************* DIAMOND TOP ***************************************

<trial HRT1>

/ stimulustimes = [1 = fixation; 800 = Diamond_Top, Red_BR, Grey_Top_Right, Grey_Bottom, Grey_Bottom_Left, Grey_Top_Left, xdat1]

/ correctresponse = (Diamond_Top)

/ validresponse = (Red_BR, Diamond_Top)

/ ontrialbegin = [values.reward = values.highreward]

/ ontrialend = [values.RT = trial.HRT1.latency; values.points = expressions.calculatereward; values.totalscore = values.totalscore + expressions.calculatereward]

/ branch = (trial.HRT1.correct, EQ, 1, feedbacktrial)

/ branch = (trial.HRT1.correct, EQ, 0, 999)

/ trialduration = 5000

/ responsetime = 800

/ responseinterrupt = trial

</trial>

<trial HRT2>

/ stimulustimes = [1 = fixation; 800 = Diamond_Top, Red_B, Grey_Top_Right, Grey_Bottom_Right, Grey_Bottom_Left, Grey_Top_Left, xdat2]

/ correctresponse = (Diamond_Top)

/ validresponse = (Red_B, Diamond_Top)

/ ontrialbegin = [values.reward = values.highreward]

/ ontrialend = [values.RT = trial.HRT2.latency; values.points = expressions.calculatereward; values.totalscore = values.totalscore + expressions.calculatereward]

/ branch = (trial.HRT2.correct, EQ, 1, feedbacktrial)

/ branch = (trial.HRT2.correct, EQ, 0, 999)

/ trialduration = 5000

/ responsetime = 800

/ responseinterrupt = trial

</trial>

<trial HRT3>

/ stimulustimes = [1 = fixation; 800 = Diamond_Top, Red_BL, Grey_Top_Right, Grey_Bottom_Right, Grey_Bottom, Grey_Top_Left, xdat3]

/ correctresponse = (Diamond_Top)

/ validresponse = (Red_BL, Diamond_Top)

/ ontrialbegin = [values.reward = values.highreward]

/ ontrialend = [values.RT = trial.HRT3.latency; values.points = expressions.calculatereward; values.totalscore = values.totalscore + expressions.calculatereward]

/ branch = (trial.HRT3.correct, EQ, 1, feedbacktrial)

/ branch = (trial.HRT3.correct, EQ, 0, 999)

/ trialduration = 5000

/ responsetime = 800

/ responseinterrupt = trial

</trial>


This works perfectly.

However, the following is from my next task in which I've employed almost exactly the same script and I keep getting error messages such as "Expression values.reward is invalid. Expression contains an unkown element or property name." Similar messages appear for values.RT too (and perhaps others but I haven't yet checked).

******************************************************** VALUES & EXPRESSIONS ********************************************************

<values>

/ normalreward = 1

/ reward = 0

/ RT = 0

/ points = 0

/ totalscore = 0

</values>

<expressions>

/ calculatereward = max (0, (1000 - values.RT) * 0.002 * values.reward)

</expressions>

******************************** ERROR FEEDBACK *********************************

<trial 999A>

/ stimulusframes=[1=error_A]

/ response = timeout(1000)

/ recorddata = false

</trial>

<text error_A>

/ font = ("Arial", 50, 400, 0, 34)

/ items = ("Incorrect! You lose 5 ALCOHOL points")

/ position = (50,50)

/ color = (255, 0, 0)

/ txbgcolor = (0, 0, 0)

</text>

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

<trial 999C>

/ stimulusframes=[1=error_C]

/ response = timeout(1000)

/ recorddata = false

</trial>

<text error_C>

/ font = ("Arial", 50, 400, 0, 34)

/ items = ("Incorrect! You lose 5 CHOCOLATE points")

/ position = (50,50)

/ color = (255, 0, 0)

/ txbgcolor = (0, 0, 0)

</text>

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

<trial 999N>

/ stimulusframes=[1=error_N]

/ response = timeout(1000)

/ recorddata = false

</trial>

<text error_N>

/ font = ("Arial", 50, 400, 0, 34)

/ items = ("Incorrect! You lose 0 points")

/ position = (50,50)

/ color = (255, 0, 0)

/ txbgcolor = (0, 0, 0)

</text>

******************************** POSITIVE FEEDBACK *********************************

<trial A_FBtrial>

/ stimulusframes = [1 = A_FBtext]

/ response = timeout (1000)

/ recorddata = false

</trial>

<text A_FBtext>

/ items = ("Correct! You win <%values.points%> ALCOHOL points")

/ fontstyle = ("Arial", 4.79%, false, false, false, false, 5, 0)

/ position = (50,50)

/ color = (0, 255, 0)

/ txbgcolor = (0, 0, 0)

</text>

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

<trial C_FBtrial>

/ stimulusframes = [1 = C_FBtext]

/ response = timeout (1000)

/ recorddata = false

</trial>

<text C_FBtext>

/ items = ("Correct! You win <%values.points%> CHOCOLATE points")

/ fontstyle = ("Arial", 4.79%, false, false, false, false, 5, 0)

/ position = (50,50)

/ color = (0, 255, 0)

/ txbgcolor = (0, 0, 0)

</text>

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

<trial N_FBtrial>

/ stimulusframes = [1 = N_FBtext]

/ response = timeout (1000)

/ recorddata = false

</trial>

<text N_FBtext>

/ items = ("Correct! Your Reaction Time was <%values.RT%> ms")

/ fontstyle = ("Arial", 4.79%, false, false, false, false, 5, 0)

/ position = (50,50)

/ color = (0, 255, 0)

/ txbgcolor = (0, 0, 0)

</text>

************************************* STANDARD TRIALS 1 *********************************************

<trial 1>

/ stimulustimes = [1 = fixation; 500 = yellow_up; 800 = blackleft_down, blackright_down, blackcentre_down, xdat1; 4999 = end]

/ correctresponse = (blackleft_down)

/ validresponse = (blackleft_down, blackright_down, blackcentre_down)

/ ontrialbegin = [values.reward = values.normalreward]

/ ontrialend = [values.RT = trial.1.latency; values.points = expressions.calculatereward; values.totalscore = values.totalscore + expressions.calculatereward]

/ branch = (trial.1.correct, EQ, 1, C_FBtrial)

/ branch = (trial.1.correct, EQ, 0, 999C)

/ trialduration = 5000

/ responsetime = 800

/ responseinterrupt = trial

</trial>

<trial 2>

/ stimulustimes = [1 = fixation; 500 = green_up; 800 = blackleft_down, blackright_down, blackcentre_down, xdat2; 4999 = end]

/ correctresponse = (blackright_down)

/ validresponse = (blackleft_down, blackright_down, blackcentre_down)

/ ontrialbegin = [values.reward = values.normalreward]

/ ontrialend = [values.RT = trial.2.latency; values.points = expressions.calculatereward; values.totalscore = values.totalscore + expressions.calculatereward]

/ branch = (trial.2.correct, EQ, 1, A_FBtrial)

/ branch = (trial.2.correct, EQ, 0, 999A)

/ trialduration = 5000

/ responsetime = 800

/ responseinterrupt = trial

</trial>

<trial 3>

/ stimulustimes = [1 = fixation; 500 = pink_up; 800 = blackleft_down, blackright_down, blackcentre_down, xdat3; 4999 = end]

/ correctresponse = (blackcentre_down)

/ validresponse = (blackleft_down, blackright_down, blackcentre_down)

/ ontrialbegin = [values.reward = values.normalreward]

/ ontrialend = [values.RT = trial.3.latency; values.points = expressions.calculatereward; values.totalscore = values.totalscore + expressions.calculatereward]

/ branch = (trial.3.correct, EQ, 1, N_FBtrial)

/ branch = (trial.3.correct, EQ, 0, 999N)

/ trialduration = 5000

/ responsetime = 800

/ responseinterrupt = trial

</trial>


I can't figure out what the problem is as - as far as I can tell - both scripts seem almost identical in their feedback settings.

Thanks again for any help you can give,

Best Jay

***JayD***
***JayD***
Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)
Group: Forum Members
Posts: 17, Visits: 67
Hi,

I've figured out what the problem is - an additional "values" element was tucked away in the script which had gone unnoticed (it was a remnant of an earlier version of the task).

Thanks,

Jay

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: 103K
Indeed, multiple <values> elements in a given script elements are not supported in Inquisit 3 (they are in Inquisit 4, though). Glad you were able to identify the issue.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search