Randomization of tasks across time

27 views
Skip to first unread message

Benedek Kurdi

unread,
Jun 8, 2023, 1:08:40 PM6/8/23
to Minno.js, arin.k...@yale.edu

Hi all,
We are running a study in which the same participants will be invited back to complete the same IATs multiple times, across a period of one year.
We would like to make sure that three things are constant across administrations of the study for each participant:
(1) The order of the two IATs
(2) The order of explicit and implicit measures
(3) The order of the critical blocks in each IAT
In the past I have used a participant-provided variable to set a random seed to keep certain types of randomization constant across time points (e.g., which image gets assigned to be the experimental target and which to be the control target in a learning paradigm). Here I'm a little unsure as to whether the same technique can be used because my understanding is that at least the order of tasks should already be determined when the manager file is loaded, which is at the very beginning of the study, before the participant can provide the number sequence used as the random seed.
I'm also not totally sure how to use this technique to keep the IAT block order constant. Is there a way to do it within the IAT task itself, or should I just create two separate IAT files (one with congruent first and one with incongruent first order) and then just select among those tasks?
Thank you so much for your help in advance!
—Benedek 

Andrew Dzik

unread,
Jun 8, 2023, 1:18:07 PM6/8/23
to Benedek Kurdi, Minno.js, arin.k...@yale.edu
Hey Benedek,
You can test, but I'm pretty sure that mixers in Minno don't actually randomize until the participant gets to them.  Remember that some mixers do things based on participant answers to questionnaires, so they can't randomize ahead of time.  So your random seed solution should work.

Andy Dzikiewicz

--
You received this message because you are subscribed to the Google Groups "Minno.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minnojs+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/minnojs/CAPGF78HDLyD2Zmey9s0t0VRWJUDt0%3DMm83rQaSouZ0_PbnzzAw%40mail.gmail.com.

Andrew Dzik

unread,
Jun 8, 2023, 1:25:30 PM6/8/23
to Benedek Kurdi, Minno.js, arin.k...@yale.edu
If that doesn't work then you could use branch mixers using the participant random hash.  Use the modulus operator, so you'd have like var order=participantHash%8
And then the order variable would be one of the 8 possible configurations.  

Benedek Kurdi

unread,
Jun 8, 2023, 2:05:50 PM6/8/23
to Andrew Dzik, Minno.js, arin.k...@yale.edu

Hi Andy,
Thanks so much for the quick response. Things seem to be working almost perfectly, there are two issues:
(1) This is not a huge problem, but I don't really understand why it's happening. If I try to save the impexptasks variable (which defines the task order based on the random seed) into global (lines 235–236) the study doesn't run and I get the following error message:
Screenshot 2023-06-08 at 1.59.53 PM.png
(2) This is a much bigger issue: Once I get to the end of the tasks that are denoted by the impexptasks variable, I see a blank white screen and the study doesn't progress to the next task.
Do you know what might be happening with either of these?
Thanks again!
—Benedek
--
Benedek Kurdi
768 State St
New Haven, CT 06511
international1.mgr.txt

Andrew Dzik

unread,
Jun 8, 2023, 2:52:15 PM6/8/23
to Benedek Kurdi, Minno.js, arin.k...@yale.edu
1.  impexptasks is an array.  The api.save code doesn't know how to save an array.  Changing it to a string first would probably work, like
API.save(impexptasks.toString());

Or you could do something similar to how you are saving other arrays, such as
 API.save({blackFaces:blackFaces});
Note that since your array is 2 dimensional the code would be a bit more complicated than that
2.  I think you actually have 1 task left in the impexptasks set that is causing the issue.  Whatever your last task in that list is is broken somewhere in it.  I made a test study and other tasks work fine, it is {inherit:impexptasks[0][6]} that is failing to load.

Andrew Dzik

unread,
Jun 8, 2023, 2:56:22 PM6/8/23
to Benedek Kurdi, Minno.js, arin.k...@yale.edu
Actually for 2, you have 6 tasks in the array, but are trying to load 7 tasks from it.  array starts with 0 for the first element, so  impexptasks[0][6] is the 7th element of the first array in  impexptasks.  I think you can just delete that task and it will work.

Benedek Kurdi

unread,
Jun 8, 2023, 3:15:23 PM6/8/23
to Andrew Dzik, Minno.js, arin.k...@yale.edu

Thanks so much, Andy. It's all working perfectly now.
(I blame the indexing thing on R, which starts at 1... 😅)

Benedek Kurdi

unread,
Jun 13, 2023, 9:44:10 AM6/13/23
to Andrew Dzik, Minno.js, arin.k...@yale.edu

Hi Andy,
It turns out that unfortunately the randomization is not working after all; instead we are just getting the same fixed order of tasks no matter what we enter for the random seed. The section with the randomization is in lines 178–254.
Thanks so much for looking into this.
—Benedek
international1.mgr.txt

Andrew Dzik

unread,
Jun 13, 2023, 10:41:00 AM6/13/23
to Benedek Kurdi, Minno.js, arin.k...@yale.edu
All the random javascript in the manager file will run at the start of the study before any tasks.  Your randomization code is running before the questionnaires where the participant enters their info.  You need it to run in an onEnd for the 2nd questionnaire, or a pre function for the next task.

Benedek Kurdi

unread,
Jun 13, 2023, 11:17:10 AM6/13/23
to Andrew Dzik, Minno.js, arin.k...@yale.edu

You need it to run in an onEnd for the 2nd questionnaire, or a pre function for the next task.
I'm sorry, what does this mean? I moved the code for randomization to a task that's after the task where they enter the random seed. But I'm not sure what to do going forward.

Benedek Kurdi

unread,
Jun 16, 2023, 11:19:25 AM6/16/23
to Andrew Dzik, Minno.js, arin.k...@yale.edu

Hi Andy,
Just writing to follow up on this.
Thanks so much!
—Benedek

Andrew Dzik

unread,
Jun 16, 2023, 1:20:18 PM6/16/23
to Benedek Kurdi, Minno.js, arin.k...@yale.edu
You still aren't understanding.  Where the js code is in the file physically doesn't matter.  Anything not in the onEnd part such as lines 13-15 in seed2.js will be run before the participant takes the questionnaire.  Your randomization code is still happening before the participant answers the question and global.questResp = questResp; line is executed.  You need the randomization to happen after it.

Yoav Bar-Anan

unread,
Jun 16, 2023, 2:02:04 PM6/16/23
to Andrew Dzik, Benedek Kurdi, Minno.js, arin.k...@yale.edu
Hi Andy, 

I am also having a hard time understanding how exactly it is supposed to be programmed. I understand that the line 
var rand = generatePRNG(global.questResp);
must run after there is a response. Say, at the end of seed2, if that's the task that sets this response variable. 

But then, that would not affect the following code from the manager because it was already defined earlier:
{inherit:impexptasks[0][0]},
{inherit:impexptasks[0][1]},
{inherit:impexptasks[0][2]},
{inherit:impexptasks[0][3]},
{inherit:impexptasks[0][4]},
{inherit:impexptasks[0][5]},

So, how do you recommend setting the order of the tasks based on a code that would run at the end another task (the questionnaire)?

Thanks,
Yoav



Andrew Dzik

unread,
Jun 16, 2023, 2:43:44 PM6/16/23
to Yoav Bar-Anan, Benedek Kurdi, Minno.js, arin.k...@yale.edu
Hey Yoav,
Thanks for that correction!  I had thought that mixers didn't run until the participant reached them, but I see now that only generally applies for the randomization part.  I found a solution by using  a "custom" mixer.  That actually will run the code only when the participant reaches it.  So put all the randomization code in that instead of seed2.js, and it will get the correct sequence.  I've attached my version of the manager file I used for testing it.  Rename to .js for your study, or copy/paste it in.

Andy Dzikiewicz
international1.mgr.txt

Andrew Dzik

unread,
Jun 16, 2023, 2:50:38 PM6/16/23
to Yoav Bar-Anan, Benedek Kurdi, Minno.js, arin.k...@yale.edu
An alternate method that wouldn't need to resort to the "custom" mixer would have been instead of the impexptasks array to generate a number in global object between 0-3 at the end of seed2.js, lets call it sequenceOrder.  Then use a "choose" mixer, choosing based on the  sequenceOrder variable, and have the 4 possible orders as options for the choose mixer.  Since you already had the array set up it was easier for me to use the custom mixer in this case.

Andrew Dzik

unread,
Jun 16, 2023, 2:51:19 PM6/16/23
to Yoav Bar-Anan, Benedek Kurdi, Minno.js, arin.k...@yale.edu
Sorry, "branch" mixer, not "choose"

Benedek Kurdi

unread,
Jun 16, 2023, 4:14:54 PM6/16/23
to Andrew Dzik, Yoav Bar-Anan, Minno.js, arin.k...@yale.edu

Thank you so much, this seems like it's working perfectly. My collaborator will confirm early next week.
—Benedek
Reply all
Reply to author
Forward
0 new messages