OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): v2020.1.3
Standard Standalone? (y/n) Y
What are you trying to achieve?: Balancing response keys across participants so half of participants respond ‘yes’ with ‘z’ and ‘no’ with ‘m’ and the other half respond ‘no’ with ‘z’ and ‘yes’ with ‘m’
I’m working with a task that involves sentences being presented to participants, followed by a comprehension question occurring after roughly 50% of those sentences. Currently, participants are asked to respond ‘yes’ to these questions with the Z key and ‘no’ with the M key. However, I want to balance these response options so half of participants answer ‘yes’ with the M key and ‘no’ with Z.
I’ve scoured these forums but I didn’t come across any clear answers. If you need any further information I’d be happy to provide, thanks for your help in advance! Below are some screens from my current experiment and data file.
Comp Q response options:
Data file correct Answer structure:
The way I do this is by having an array for response keys, e.g.
responseKeys=[['s','the S key'],['k','the K key']]
I then shuffle responseKeys and use responseKeys[primAns][0] for the correct answer and responseKeys[0][1] and responseKeys[1][1] in the instructions. You could then have 0 and 1 in your primAns column.
1 Like
Hi Wakecarter,
where we should write these codes?
I want to have a counter balance for two keys.
I have two options one says (away from each other) and the other says (toward each other) which refers to point that FirstPartWords and SecPartsWords move away from each other or toward each other.
I have an excel file for counterbalance.
I have created a loop for counter balance too.
I would appreciate it if you can help me with this issue.
Best,
Hamid
I put the code in Begin Experiment.
How are you currently setting these text components?
e.g.
responseOptions=['toward','away from']
shuffle(responseOptions)
then one text component would be
$'f = ' + responseOptions[0] + ' each other'
and the other would be
then one text component would be
$'k = ' + responseOptions[1] + ' each other'
You’ll also need to set the answer key. For example
thisAnswer = 'f'
if Answer = 'away' and responseOptions[1] == 'away':
thisAnswer = 'k'
elif Answer = 'toward' and responseOptions[1] == 'toward':
thisAnswer = 'k'
Thank you so much. I appreciate your help. I could figure out what to do.