Reply To: Reaction times of a selector response

PennController for IBEX Forums Support Reaction times of a selector response Reply To: Reaction times of a selector response

#5009
Jeremy
Keymaster

Hi Kayla,

The reason why there is no ‘reaction time’ column by default is precisely because the starting point is arbitrary: which event do you consider relevant to start measuring how fast your participants are to answer?
By default PennController logs when the trial starts, so if that’s what you want, you can use that EventTime to subtract from the selection’s EventTime. If you’d rather refer to, say, the display of an image as your starting point, then you can use the .log command on the Image element (or its containing Canvas) and you’ll have a line in your results file reporting when the image was printed on the screen.
The very last page of the tutorial includes an R script that illustrates how to calculate reaction times using the EventTime column (with the beginning of the trial as the starting point).

Yet another option is to calculate the RTs upon runtime, and add a “ReactionTime” column to your trials using .log on newTrial. For that, you need to use a Var element, like this:

Template( row =>
  newTrial(
    newButton("Start the trial").print().wait().remove()
    ,
    newSelector("choice").once()
    ,
    defaultImage.size(200,200).selector("choice")
    ,
    newCanvas( 400 , 200 )
      .add(   0 , 0 , newImage( row.target     ) )
      .add( 200 , 0 , newImage( row.competitor ) )
      .print()
    ,
    newVar("RT").global().set( v => Date.now() )
    ,
    getSelector("choice").shuffle().wait()
    ,
    getVar("RT").set( v => Date.now() - v )
    ,
    newTimer(500).start().wait()
  )
  .log( "ReactionTime" , getVar("RT") )
)

Jeremy