reponse time only for correct response
in OpenSesame
How I can get average response time only for correct responses?
How I can get average response time only for correct responses?
Comments
Hi dn,
you may use the correct_response variable and write an inline_script for this.
For instance you may calculate the median (remember that RTs are not normally distributed) like this
if var.correct_Resp==1: var.medianLst.append(var.response_time_Resp) var.median=var.medianLst[len(var.medianLst)/2]Thanks DahmSF but I don't know how to use inline_script . Can you suggest me an easy mode to obtain my request or to explain me step by step what have to do ? Then, I need mean response time of correct responses not the median... I hope to solve this "simple" problem in short time .
Hi dn1,
Do you need the RTs in the experiment, or only during data analysis? If the latter, I would suggest you don't bother to implement average RTs inside Opensesame, but only do it in the data analysis in whichever software you use.
but I don't know how to use inline_script .
In this case, I would recommend you do a tutorial on Python. Inlinescripts are just items in which you can script your experiment directly without using pre-made items (like sketchpads, samplers, loggers, etc). Under the hood, most of the processes in Opensesame are based on Python. The computation of average response time is no exception to that.
Can you suggest me an easy mode to obtain my request or to explain me step by step what have to do ?
In order to only show correct RTs, you have to keep track of the accuracy of a response and its delay. To do so, you need a response. Therefore, you have to put your inline_script after the keyboard_response. More specifically, the code to compute RTs have to be in the run phase of the inline_script, because in the prepare phase no response has yet been given (see the docs for details). The actual code that you need to do is something like this:
if var.correct == 1: var.total_correct_response_time += var.response_time var.trial_no_correct += 1Essentially, this adds the current RT to all RTs, only if the response was correct.
Additionally, you need to do 2 things.
1) Initialize the variables
var.total_correct_response_timeandvar.trial_no_correct.As you use it in the script, it needs to exist first. To create it, you can simply put another inline_script in the beginning of the block loop (or experimental loop depending over which period you want to compute the RTs) and put in the prepare phase this code:var.total_correct_response_time=0and likewise for the other variable2) Compute average RTs, based on this new variable. This can easily be done with this code, placed in another inline_script at the end of the block or the experiment:
var.avg_correct_response_time= var.avg_correct_response_time/var.total_no_correctThis new variable you can then add to the feedback item.
Does that make sense?
Eduard
Thanks for the answers but let me explain better whati I find . If I use the item "feedback" I get the percentage of accuracy and the average response time calculated on all the answer of a group of trial. Instead I want opensesame give me the percentage of accuracy and the average latency time calculaated only on the correct responses. What can I do?
Hi,
You need to do what I described in the previous post. Computing new variables that are based on correct and not all responses. From the 2. quote onwards I was giving instruction as to how present RTs of only correct variables. So, how about you try to follow these instructions?
Good luck,
Eduard
ps.
"accuracy and the average latency time calculaated only on the correct responses"
accuracy of only correct responses is always 100%
Hi dn1,
to make it easier for you:
Try to use this code in your inline script. One script should be enough. You may then access the variable var.avg_correct_response_time in any feedback item after that inline_script.
if var.correct == 1: var.total_correct_response_time += var.response_time var.trial_no_correct += 1 var.avg_correct_response_time= var.total_correct_response_time/var.total_no_correctCheers,
Stephan