Millisecond Forums

feedback for multiple blocks and subsequent branching

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

By ememem - 8/1/2016

Hello,

I currently have four practice blocks and I would like to show feedback for response latency and % accuracy at the end of these blocks. I know that I can use the /blockfeedback for each block individually, but is there a way for me to show the total response latency and accuracy for all the practice blocks together?

Following on from that, in order to proceed to the test blocks, participants need to reach 70% accuracy and have a maximum latency of 2000ms. How can I force repeat the practice blocks if participants fail to meet this requirement?

Thank you for your time.

By Dave - 8/1/2016

You cannot use the simple /blockfeedback. You'll want to set up a bunch of <values> (global variables) and <expressions> to calculate and track the performance. You can report those via standard <page> elements in /postinstructions at the end of your practice block(s).

You then can /branch from your final practice block back to the 1st practice block and so forth if the participant has not met the performance criteria you set.
By ememem - 8/1/2016

Hi Dave, 

I'm sorry, but I don't understand how to use values and expressions. I have no experience with coding language or scripting so this is very difficult to understand. Following on from http://www.millisecond.com/support/docs/v4/html/language/express.htm and http://www.millisecond.com/support/docs/v4/html/language/expressions/functions.htm I ended up with something like this, but it doesn't work.

practice block with true keyed to left
<block compatiblepractice>
/ bgstim = (trueleft, falseright)
/ trials = [1 = instructions; 2 = practice; 3 =instructions1; 4 =instructionsleft; 5-24 = noreplace(aaleft, aaleft2, bbleft, bbleft2)]
/ errormessage = true(error,200)
/ responsemode = correct
/ recorddata = false
/ onblockend = [meanlatency(block.compatiblepractice);percentcorrect(block.compatiblepractice)]
</block>

practice block with true keyed to right

<block compatiblepracticeswitch>
/ bgstim = (trueright, falseleft)
/ trials = [1 = instructionsright; 2-41 = noreplace(aaright, aaright2, bbright, bbright2)]
/ errormessage = true(error,200)
/ responsemode = correct
/ recorddata = false
/ onblockend = [meanlatency(block.compatiblepracticeswitch);percentcorrect(block.compatiblepracticeswitch)]
</block>

INCOMPATIBLE PRACTICE

practice block with true keyed to left
<block incompatiblepractice>
/ bgstim = (trueleft, falseright)
/ trials = [1 = instructions2; 2 = instructionsleft; 3-22 = noreplace(ableft, ableft2, baleft, baleft2)]
/ errormessage = true(error,200)
/ responsemode = correct
/ recorddata = false
/ onblockend = [meanlatency(block.incompatiblepractice); percentcorrect(block.incompatiblepractice)]
</block>

practice block with true keyed to right
<block incompatiblepracticeswitch>
/ bgstim = (trueright, falseleft)
/ trials = [1 = instructionsright; 2-41 = noreplace(abright, abright2, baright, baright2)]
/ errormessage = true(error,200)
/ responsemode = correct
/ recorddata = false
/ onblockend = [meanlatency(block.incompatiblepracticeswitch);percentcorrect(block.incompatiblepracticeswitch)]
/ postinstructions = (feedback)
</block>

<values practice>
/ totalmeanlatency = totalmeanlatency(block.compatiblepractice, block.compatiblepracticeswitch, block.incompatiblepractice, block.incompatiblepracticeswitch)
/ totalpercentcorrect = totalpercentcorrect(block.compatiblepractice, block.compatiblepracticeswitch, block.incompatiblepractice, block.incompatiblepracticeswitch)
</values>

<instruct>
/ txcolor = (0, 0, 0)
/ screencolor = (255, 255, 255)
/ nextkey = (" ")
/ nextlabel = "Press space bar to continue"
</instruct>

<page feedback>
Your average response time was <%round(values.totalmeanlatency)%>
^^Your average accuracy rate was <%round(values.totalpercentcorrect)%>
</page>

Could you please explain how to use values and expressions? 
Thank you.

By Dave - 8/1/2016

You sum up the number of trials, the number of correct responses and the trials' latency via /ontrialend. You store the results in global variables (i.e. <values>). You use expressions to calculate the percentage correct and mean latency based on those values.

The below, very simple example with 3 "practice blocks" p1 to p3 should clarify:

<values>
/ n_trials = 0
/ n_correct = 0
/ sum_latency = 0
</values>

<expressions>
/ pct_correct = (values.n_correct/values.n_trials)*100
/ mean_rt = (values.sum_latency/values.n_trials)
</expressions>

<expt>
/ blocks = [1=p1; 2=test]
</expt>

<block p1>
/ onblockbegin = [values.n_trials = 0; values.n_correct = 0; values.sum_latency = 0; ]
/ preinstructions = (practiceintro)
/ trials = [1-10 = a]
/ branch = [block.p2]
</block>

<block p2>
/ trials = [1-10 = b]
/ branch = [block.p3]
</block>

<block p3>
/ postinstructions = (practicefeedback)
/ trials = [1-10 = noreplace(a,b)]
/ branch = [if (expressions.pct_correct < 70 || expressions.mean_rt > 2000) block.p1]
</block>

<trial a>
/ ontrialend = [values.n_trials += 1; values.n_correct += trial.a.correct; values.sum_latency += trial.a.latency; ]
/ stimulusframes = [1=a_stim, debug]
/ validresponse = ("a", "b")
/ correctresponse = ("a")
</trial>

<trial b>
/ ontrialend = [values.n_trials += 1; values.n_correct += trial.b.correct; values.sum_latency += trial.b.latency; ]
/ stimulusframes = [1=b_stim, debug]
/ validresponse = ("a", "b")
/ correctresponse = ("b")
</trial>

<text a_stim>
/ items = ("Press 'A'")
</text>

<text b_stim>
/ items = ("Press 'B'")
</text>

<block test>
/ preinstructions = (testintro)
</block>

<page practiceintro>
^This is practice.
</page>

<page practicefeedback>
^You completed <%values.n_trials%> practice trials.
^You responded correctly in <%values.n_correct%> trials, that is <%expressions.pct_correct%> %.
^Your mean response latency was <%expressions.mean_rt%>.
</page>

<page testintro>
^This is where the actual test phase would start.
</page>

<text debug>
/ items = ("Trials completed: <%values.n_trials%> | Correct responses: <%values.n_correct%> | Percentage correct: <%expressions.pct_correct%> | Mean latency: <%expressions.mean_rt%>")
/ position = (50%, 10%)
/ size = (90%, 10%)
/ erase = false
</text>

By ememem - 8/2/2016

Thank you so much Dave!
That was really helpful. Your example was really easy to follow along and understand! Thank you!