Reaction times of a selector response

PennController for IBEX Forums Support Reaction times of a selector response

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #5008
    kaylac
    Participant

    Hi Jeremy,

    I used selector in my experiment but found that I only get the element I chose recorded under the column “value” and not the reaction time I took to choose it. Is there a way to include reaction times? If the only way is to calculate reaction times from values in the “EventTime” column (by the EventTime of selection minus the EventTime of the starting point), which starting point I should refer to?

    Thanks so much for your help!!

    Kayla

    #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

    #5013
    kaylac
    Participant

    Thanks, Jeremy! This helps a lot!

    Kayla

    #5091
    glossaphile
    Participant

    How might I print a reaction time (or any numerical information) to the screen during the experiment? The “print()” command doesn’t work on a Var element or even on a Text element created by “newText(getVar(“VarName”)).” In the former case I get nothing, and in the latter case I get “undefined.”

    • This reply was modified 3 years, 11 months ago by glossaphile.
    #5093
    Jeremy
    Keymaster

    Hi,

    As you found out, you cannot pass a Var element to initiate another element. This is because all the new* commands (but not their corresponding blocks of commands) are evaluated at the very beginning of the experiment, at which point the Var elements have not been set in the yet-to-come flow of trial events.

    What you can do instead is use the .text command of the Text element, like this:

    newVar("RT").set( v=>Date.now() )
    ,
    newButton("Click!").print().wait()
    ,
    getVar("RT").set( v=>Date.now()-v )
    ,
    newText().text( getVar("RT") ).print()

    Jeremy

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.