If this template helps then use it. If not then just delete and start from scratch. PsychoPy version v2022.2.4
**Standard Standalone? yes
Hello,
I use a keyboard component where I specify a few numerical values as ‘allowed keys’. It works well and is saved well in the .csv.
However, I noticed that the ‘store correct’ function does not seem to be working properly, and interprets and saves all responses as wrong (i.e., 0) even if the correct button was pressed.
There is the ‘store correct’ input box in the builder. I experimented with different ways of defining what is the correct response (namely keypress ‘2’) by putting: 2, ‘2’, $2, $‘2’, etc.
I found on this forum that all responses being saved as wrong (as 0) used to be a problem with previous PsychoPy versions (e.g., Correct response variable not recognised for new experiment with new version: 'key_resp.corr' always FALSE - #15 by TParsons).
But I believe this was resolved already, and I am using the new 2022.2.4 version.
Is it possible to have two alternative responses defined as ‘correct’ response? In my experiment, the allowed keys are 1,2,3,4, and a correct response would be 3 OR 4 (a press ends a routine, participants are instructed to press one button, and as long as they press 3 OR 4 I wish to store it as correct). Input such as 3 or 4 does not work. But I think it is necessary to resolve problem 1) first.
Would you have any suggestions to my question 1) and subsequently 2? Please note that the ‘store correct’ does not work even if I define just one correct response (e.g., just 3). I thought the problem was with wanting to have two options for correct response, but it does not work for one either.
to use the Correct answer feature of a keyboard-component you need to specify a column in your Excel-file. In the example below I specify $corrAns in Correct Answer and the Excel-file has a column name corrAns. This column contains the correct key, the participant has to press. In the example it is a j. AFAIK, you can specify as many correct keys as you want but only one per trial. So another correct key in this experiment is a f.
If you want more one correct key in a trial, you either need some code in PsychoPy or compute the correctness of your answer during data analysis.
Thank you so much for your kind and exhaustive reply. It is helpful, and following your advice I will compute correctness on the data analysis stage then.
It is quite interesting that a Excel column needs to be added, rather than input being taken from an Excel OR straight from the line (like for the ‘allowed keys’) for example.
I am having the exact same problem in my experiment except I am using an older version of Psychopy (2021.1.2). The problem is I have already created my entire experiment without using an excel file. Is there no way of storing multiple correct answers without using an excel file?
In addition, storing one correct response works fine (using the syntax $‘2’ for example). But I’ve tried multiple times with multiple variables and I always get an output of 0 for correct response in the data sheet.
Examples of syntax I’ve tried:
2 4 5
2, 4, 5
2,4,5
$245
$2,$4,$5
$‘2’,$‘4’,$‘5’
$‘2’,‘4’,‘5’ → gives me an error and ends the experiment
As afterthoughts from @JensBoelte and @vhetgui,
I am still surprised that for me (Psychopy v2022.2.4) the ‘store correct’ input box does not even work when inputting just one correct key (always saves response as incorrect/0 in the .csv file).
It seems like at least a single key should be accepted straight from the input box to evaluate whether the response was correct, without creating an additional column in the .csv.
Especially given that it works for @vhetgui in a different version.
Could there be a deeper reason for why Psychopy v.2022.2.4 does not seem to accept input from the ‘store correct’ input box? Was it an intentional change made for v.2022.2.4?
Thank you for your kind response. This absolutely makes sense.
However, I am still wondering whether it was a change introduced to Psychopy 2022.2.4 that even if we just want to have 1 correct key, it still does not work simply by inputting the key (e.g., 1 or ‘1’,. etc.) in the ‘store correct’?
This function is there, and it should work without code component or Excel.
It seems like it was a recurring issue in the past (that the correctness was not working in the Builder), therefore I wonder if this is an issue that has yet again returned in the new v2022.2.4. I think it would be important to determine.
Because before I will go to code component, I would like to ensure that the most basic functionalities work properly.
I completely agree with you! Why does this Store correct checkbox exist if it fails one of the easiest use case?
I am using v2024.2.4 and seem to have the same issue. My condition file has a column called correct_response and in the Keyboard routine under Data I checked Store correct and entered $correct_response but the .corr column is always zero.
I’ve now tried adding this code to the End routine of the trial but I still only get 0s.
trial_resp.corr is still always zero. I’ve seen the suggestion to change the condition spreadsheets but unfortunately this is not option in this case.
Edit: I found a solution that is highly specialised for my experiment so there is no point in sharing but it’s still think frustrating that the checkbox doesn’t work.
Storing a correct or incorrect answer should work with `Store correct’. See this little toy experiment which stores 1 for correct answers, 0 for incorrect answers and None if you do not answer. The task is to press the number shown.
@JensBoelte, Yes! I take everything back. It was entirely my fault because occasionally my condition columns include #N/A values instead of 1 or 2 because these are blank trials. This probably prevented this variable to be parsed correctly.
Thank you so much.
For the blank trials I know added None and then I also get 1 for the accuracy.