URL of experiment:
https://run.pavlovia.org/fabianbross/randomization_question
Description of the problem:
I posted a similar question some time ago but did not get an answer and I’m starting to get crazy My issue is probably very simple to solve, but I’m not able to wrap my head around this
Very briefly: If I set the loopType to “sequential” everything runs as it should, but if I set the loopType to “random” my experiment is not balanced (see below) anymore
More detailed: The task is simple: Participants will be presented with text stimuli and corresponding questions. Participants should see twelve stimuli, six from one and six from another condition (this is what I meant by “balanced”). Stimuli should be chosen randomly from a list, i.e., an Excel sheet. In addition, they will see a bunch of fillers. I have an Excel file which looks like this (whether an x or y stimulus is chosen should be random):
conditiona | conditionb | question |
---|---|---|
x1 | y1 | question1 |
x2 | y2 | question2 |
x3 | y3 | question3 |
x4 | y4 | question4 |
x5 | y5 | question5 |
x6 | y6 | question6 |
x7 | y7 | question7 |
x8 | y8 | question8 |
x9 | y9 | question9 |
x10 | y10 | question10 |
x11 | y11 | question11 |
x12 | y12 | question12 |
filler | filler | question13 |
filler | filler | question14 |
filler | filler | question15 |
filler | filler | question16 |
filler | filler | question17 |
filler | filler | question18 |
filler | filler | question19 |
filler | filler | question20 |
filler | filler | question21 |
filler | filler | question22 |
filler | filler | question23 |
filler | filler | question24 |
filler | filler | question25 |
filler | filler | question26 |
filler | filler | question27 |
filler | filler | question28 |
I added the following code to Begin Experiment (but note that I’m really bad at programming ):
//Participants need to see six stimuli from condition one and six from condition two
newlist =
["conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo"];
//shuffle the list so that whether conditionone or conditiontwo is shown is random.
util.shuffle(newlist);
//Then they will see sixteen fillers
fillerlist =
["conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo",
"conditionone", "conditiontwo"];
//No need to shuffle the fillers
//Put the list of stimuli and the filler list together
cuelist = (newlist + "," + fillerlist);
//In the right format:
cuelist = cuelist.split(",").map(String);
So now I have a list of all stimuli I want to present named “cuelist”. To Begin Routine I added a code which takes one element from this list:
//Take the first element of cuelist:
stims = cuelist.shift();
//Write this to the data file:
psychoJS.experiment.addData("stim", stims);
//Evaluate the string as a variable
stims=window[stims];
If I run the experiment with loopType set to “sequential” everything works just fine, i.e., participants see six stimuli from the first and six stimuli from the second condition (and they are randomly chosen) However, if I set the loopType to “random” this does not work anymore. Sometimes four stimuli from the first condition are shown and eight from the second or five from the first and seven from the second. Meaning: My balancing is gone.
Probably (and hopefully) I’m overlooking something really simple and stupid I would be really, really greateful if someone could point me into the right direction