psychopy.org | Reference | Downloads | Github

Counterbalancing


#1

Hi,

I am running an experiment where participants see two images presented side by side on the screen. An image is paired with either a neutral or a negative image and I am trying to counterbalance which images will appear with the neutral and which will appear with the negative. Basically, in one trial I was 30 images to be paired with negative images and in the next trial those same 30 images to appear with the neutral images.

I have tried to follow the counterbalancing code from the PsychoPy manual but am confused about how to include the $"group"+expInfo['group']+".xlsx" text.

So far I have set up my experiment like this:

With the ‘BOSSandNAPS’ loop box like this

and the ‘trial loop’ box like this


#3

You need to explain to us what you are trying to achieve. Do you have two conditions files you want to switch between? If so, what are they called? Are they presented in random or constant order?, etc etc.


#4

Yes, there are two condition files and I have made a third excel file to call upon each of the excel files with the images.

image

When I did this, the program would show the BOSSCritical and NAPS Pairing.xlsx first and then BOSSCritical and NAPS Pairing Second Counterbalance.xslx second.

BOSSCritical and NAPS Pairing.xlsx


BOSSCritical and NAPS Pairing Second Counterbalance.xslx

What I want, instead, is that for one participant BOSSCritical and NAPS Pairing.xlsx will be presented and for the next participant BOSSCritical and NAPS Pairing Second Counterbalance.xslx will be presented (the only difference between the BOSSCritical and NAPS Pairing.xlsx file and the BOSSCritical and NAPS Pairing Second Counterbalance.xslx file is that just the second column of images is flipped). I want it to alternate between the two mentioned excel files for each participant.


#5

You should be wary of conditions that alternate between participants: this can lead to systematic confounding (e.g. one order more likely to be presented in the morning than in the afternoon, etc). It is more secure to randomly shuffle the order across subjects.

If you don’t care about exact balancing, you can simply set the outer loop to be randomised: then roughly half of your subjects will get each order.

If you want to strictly control the balancing so exactly 50% get each order, then make two conditions files, identical except for the order of the two rows. Then instead of a fixed filename in the loop dialog, use a variable from the info dialog (i.e. on each run of the experiment, enter the file you want to use).

e.g.

expInfo['condition_file']

Lastly, get rid of all the absolute paths inside your conditions file. They only cause you pain. Use relative paths instead (and / separators rather than Windows-style \, which can also cause strange side effects in Python).