random treatment assignment while controlling for quota (Javascript?) | XM Community
Skip to main content
Hi all!



So, I would like to randomly assign participants to one of six different treatment groups, which is itself easy (e.g. using set embedded data within a randomizer and than use branches). BUT I would like to assign participants only to treatment groups, which are not "full" yet. Despite participants potentially dropping out of the survey, I want to end up with 30 responses in all treatment groups.



Therefore I try to find a way to randomize the treatment assignment, while controlling for Quotas. One could create separate randomizers within branches for all 2^6 cases (64 possibilities), like only randomize over the 5 remaining treatments if one is already full etc. However, this takes way to long and gets impractical for the next survey using even 12 treatment groups...



Ideally, I am looking for a solution using javascript, for example using a loop such that the randomizer picks a group, if the group is already full, it keeps randomizing until it randomly picked a group which is not full yet.



Does anyone of you could give me tipps on how to do this or has experience in randomly assigning treatment groups (randomly set embedded data) using javascript?



Any help is much appreciated! Thanks!!
Hi @rschnider,



I will simply add my Quota conditions within my only single randomizer. Please refer below snapshot for the example.



!



Attaching the QSF file here! Hope this helps 😀





Regards,

Samarth
@Samarth



Thanks a lot for your help!! I worried that this wouldn't work as I thought the randomizer would maybe just randomly pick one of the branches and stops there (whether the branch applies or not). But I tested it and it worked! Also the engineers at Qualtrics tested the solution and confirmed that it works properly.



Problem solved, cheerio!! 😉
I'm not sure how you are setting quotas in the random assignment. From what I can see, the quotas are tied to questions. So if you want to set quotas for randomly assigning participants into 6 groups (i.e. set quotas randomly, not tied to particular questions), how are you doing that using the survey platform?



I'm trying to do the same thing as OP, but I'm confused how they are setting their quota randomly. Would appreciate any help whatsoever!

Leave a Reply