PsychoPy version: 1.9.6
Standard Standalone? (y/n): y
What are you trying to achieve?:
I want to build a between subjects online experiment. The subjects are to be split up randomly in two groups (optimally groups of equal size). The two groups are doing the same tasks, but with alterations in text and image.
So far my team has done this by creating 2 seperate experiments, and spliting up the subjects manually. But I believe there must be a better way.
My question is: How would you build a between Subjects design in the psychopy builder?
If you want manual separation, then you can add “group” in the expInfo dialogue boxes and then add some code in the first routine to say, for example, which Excel file to used depending on the value of group.
if expInfo['group'] == '1': useSheet = group1.xlsx else: useSheet = group2.xlsx
Random separation is also fine, e.g.
if random() >.5: useSheet = group1.xlsx else: useSheet = group2.xlsx
However, you might randomly get many more in one group than the other. I have a way to try to deal with this but it’s more complicated and doesn’t work online so I’ve got another way, but that can’t take into account non-finishers.
Hey, thank you for your answer.
I actually have a similar code-snippet at the beginning ( I might use the participants ID and split by odd and even numbers). But I do not know how I can access variables that I define in the Excel file.
My online version recommends using the modulus of the participant number.
Within a loop the header columns of the Excel file are used as variable names (without a $ when used in code components).
Okay I have got it, a list of things to do for people who might happen on this:
- Add if…else-statement at beginning of experiment:
Strings are important here, expInfo[“XXX”] is a string at first, you might need to convert it. The filnames need to be strings.
if int(expInfo["participant"]) % 2 == 0: cond_file = "groupA.xlsx" else: cond_file = "groupB.xlsx"
- Create Files:
- exact names as in (1)
- First line of xlsx variable names, exactly the same in both (all) files
- second line: different between files, the things that are supposed to be different between groups
Build a loop over all routines that are supposed to be different between the groups. Set
nRep to 1
Conditions to $cond_file.
In your routines, if you want to show something different to both groups use a Variable from the .xlsx files like this:
Make sure the variables name is written the same in both xlsx and in the experiment. Also fields in which you use a variable need to be set to set every repeat
- Datatypes in the conditional can cause issues.
- Variables need to be added to both files, and called the same.
- Variable in Conditions of the loop is not the same as in the if…else- statement.
- Fields where a variable is used is still set to constant.