Reply To: Setting accuracy and RT thresholds for practice block

PennController for IBEX Forums Support Setting accuracy and RT thresholds for practice block Reply To: Setting accuracy and RT thresholds for practice block

#6044
Jeremy
Keymaster

Hi Agnes,

Unfortunately PCIbex does not support loops at the moment, because the sequence of trials is purely linear: it is computed at the very beginning of the experiment based on the Sequence command (if present) and every trial runs one after the other.

A suboptimal alternative would be to repeat the sequence of practice trials multiple times, but only run them fully if the grand average is too low. Something like this:

Sequence(
  "practice" , "post-practice" ,
  "practice" , "post-practice" ,
  "practice" , "post-practice" ,
  "practice" , "post-practice"
  ,
  "pre-experiment" , "experiment" 
)

Template( "practice.csv" , row => 
  newTrial( "practice" ,
    newVar( "responses" , [] ).global(),
    newVar("grandaverage", 0).global()
        .test.is( v => v>=0.5 ).success( end() )
    ,
    newText( row.Word ).print()
    ,
    newKey( "choice" , "FJ" ).log().callback( getTimer("timewindow").stop() )
    ,
    newTimer( "timewindow" , row.Time ).start().wait()
    ,
    getKey("choice").disable().test.pressed( row.Correct )
        .success(  getVar("responses").set(v=>[true,...v]) )
        .failure(  getVar("responses").set(v=>[false,...v]) )
  )
)

newTrial( "post-practice" ,
    newVar("grandaverage")
        .global()
        .test.is( v=>v>>0.5 )
        .failure( 
            newButton("Next").print().wait()
            ,
            getVar("grandaverage")
                .set( getVar("responses") )
                .set( v=>v.filter(r=>r==true).length/v.length )
        )
    ,
    newVar("responses").global().set( [] )
)

newTrial( "pre-experiment" , newButton("Start").print().wait() )

This should run the practice block up to three times, if your participant fails to reach the 50% threshold every time. Otherwise, the test on the grandaverage Var will run the end command at the very beginning of every trial in subsequent blocks, effectively skipping to the experiment trials.

Let me know if you have questions

Jeremy