Struggling to define acc for feedback
My experiment is an oddity task where a participant hears three sounds and click on the circles that lit up with the sound that was the odd one out. The cursor_roi are coded as 'left', 'centre' and 'right' for the positions of the circles.
After the mouse click response I have used the inline script below, which successfully runs feedback after each trial.
if var.target_visual in var.cursor_roi:
var.correct = 1
else:
var.correct = 0
However, I want to give feedback at the end of the block with acc% but I cannot figure out how to define the variable. I tried adding the variable 'correct_response' to the block loop, however when I use 'left', 'right' and 'centre' or [target_visual] in order to correspond to the correct roi the experiment no longer runs and says that they are invalid.
Could you let me know where I'm going wrong?
Comments
From what I can see, the problem might be that var.acc source is a keyboard response, but I can't figure out why or how to change it to the correct mouse response.
Ok, so now it just seems to reject the possibility of 'centre' being a correct response...
Apologies for continued updates. I have managed to change it to the mouse response and changed the inline script to:
While this does now calculate an accuracy score, the score is inaccurate (ironically). For example, if I get 3 out of 6 incorrect it sometimes reports 60% accuracy and other times 40% accuracy, depending on the order of the correct or incorrect answers.
Hey,
I can't say for sure what the problem is, but you can simply create your own accuracy variable. All you need is a variable that counts the total number of trials, and one that counts the total number of correct responses. Divide one by the other et voila, you have your accuracy.
In a different inline_script:
In a different inline_script:
Then you can use the variable var.accuracy, just like var.acc
Hope this helps!
Eduard