Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

Reaction times only for correct answers

Hey guys,

I'm recently working on a reaction-test with 2 possible responses but only one is right.
Now in my Log-File I can see the reaction times for correct but also for incorrect answers.
To reduce redundancies I want only the reaction times for the correct responses to be saved.
Is there any possibility to do that?



  • cescocesco Posts: 26

    Yes, but I don't see that advantage. You can save all the data and then during processing (whether you use R, Python, Matlab or good old Excel) you can filter out the incorrect trials.

  • KantarturKantartur Posts: 11

    Yes of course and I also know that its not much work but I try to enhance every little bit and that still would be a little enhancement.

    That was just out of curiosity but when there is no possibility I will filter it myself.

  • Hi guys,

    I have to admit, that I find your answer really frustrating cesco :). I have been trying to address this question last couple of hours myself without any luck.
    Let me present a scenario when it is really useful to have reaction times only for certain answers.
    I am working on Go/nogo task, where I'll be dynamically presenting feedback whose timing is based on participant's average reaction times in training blocks. For this, I need to compute reaction times only for Go trials, but at the same time I need accuracy and information about errors for both Go and Nogo trials.
    I tried probably every option within drag&drop + a little bit of scripting, but I cannot really wrap my mind around it so any help would be nice.

    Best regards,


  • RoelofRoelof Posts: 79

    Hi Jiri,

    I think the easiest way would be to use an inline script with an if statement that saves the RT only if the answer is correct, in the attachment an example. Accuracy is still present as var.acc, hope this helps, if the code is unclear let me know, good luck,


  • Hi Roelof,

    thanks a lot for a reply! I have been able to adapt the first part of your code, but I am struggling with the second part: computing the mean response time for trials of interest. My code always prints only the last of response time but does not compute the mean (I've tried to save the go_rt as a list or as a variable, it does not matter).

    save rt for trials of interest in a new variable

    var.go_rt = []
    if var.correct == 1 and var.condition == 'Go':

    create a variable which contains the mean rt for trials of interest

    var.mean_rt = []
    if len(var.go_rt)>0:
    var.mean_rt = sum(var.go_rt)/len(var.go_rt)

    I tried to shuffle the scripts all over the place, but I guess my problem is that I still don't understand the way inline script in OS works :).

    Thank you for your time.



  • RoelofRoelof Posts: 79

    The code seems to work as far as I can tell; but the problem might be that you empty the list at the start of the script var.go_rt = [], which means that every time your list starts as an empty list, if you have a look at the experiment in the attachment you can see the list is initiated outside of the loop, so that it is not emptied every time, let me know if this solve the problem, good luck

    PS: the mean_rt variable will always only be one value right? right now you are making a list out of this variable as well, but you could get rid of var.mean_rt = []

    Thanked by 1enuma_elis
  • Great, thanks. I was able to make it work somehow by making a list from go_rt.

Sign In or Register to comment.