I’m currently designing an experiment that is going to begin with participants filling out a brief screening survey that will place them into one of three groups based on their answers. I want to ensure that my three groups are evenly distributed, with the same number of participants in each group. Is there a way that I can use Pavlovia surveys to counterbalance my groups based on their answers within the survey? Ideally, if the participant’s answers were allocated to a group that was already full, a message would come up saying thanks for their time, but they could not complete the rest of the experiment due to their answers.
Would really appreciate any advice that can be given on this. Thank you in advance!
In this case I think you need the shelf and embedded survey routines in a PsychoPy experiment. I am giving a talk on this topic at the ATSiP conference later this month.
Basically you need to retrieve the group allocation in PsychoPy, update the shelf, and then block progression if that group has reached the maximum number. Would it fit your use case if I created a simple survey (are you in group 1, 2 or 3?) and then showed how to block progression after 5 people have picked a given group number?
Hi, there! Thank you both so much for your help with this. Wakecarter that sounds pretty similar to what I’m aiming for, yes. Is it possible to do that after people have chosen multiple responses? For context, I’ll be using a standardised survey to group people based on the total score they achieve based on their answers. So I’ll want one group set to totals of 1-10, another set to 11-20, etc. Is that something that can be achieved with this method?
This demo is a PsychoPy experiment with two embedded surveys. The first is a consent form, and the second is the Alcohol Use Disorders Identification Test—Consumption (AUDIT-C) . The AUDIT-C is scored within the survey and then participants are allocated to low and high risk groups based on a cut-off. The number of participants in each group are tracked using the shelf. For demo purposes the participation cap itself can be selected in the expInfo dialogue box.
The shelf dictionary was created as {“low risk”: 0, “high risk”: 0}
I’m currently trying to implement something very similar to the experiment mentioned above. I tried the demo proposed here but I receive the following error message at the very beginning of my experiment:
when updating the value of the DICTIONARY record associated with key: [“participation-cap”]
malformed request: missing fieldName in FIELD_SET update
The rest of the experiment runs smoothly. However, it seems like it is not connecting to the shelf at all.
Since I am an absolute PsychoPy/Python beginner, I am not sure if you need any further information on my experiment to give advice on this?
Yes I did. It works now, I think it was just that PsychoPy generally did not connect with Pavlovia because it worked after I emptied the browser cache.
However, it still does not work fully… the participants all get assigned to the “low risk” group in the shelf as defined in the beginning of the experiment but this does not get updated after the score of the questionnaire was calculated. If I download the data, there is a variable “group” and there it is correct. Any idea what could be the problem here?
I changed the code according to your suggestion but this did not change anything.
The thing is, washing_scale apparently can be > 3 (or at least ‘block_1/score_washing_scale’ can be) because I can see it in the data files and also the group assignment is correct there.
So a participant with a score of 9 is assigned to high risk group in the data but to low risk group in the shelf.
If I print washing_scale it also shows the correct score which can be > 3.
My shelf entry looks like the one from your demo:
{
“low risk”: 0,
“high risk”: 0
}
And this is the code:
participationCount = await psychoJS.shelf.getDictionaryFieldNames({key: ["participation-cap"]});
//increase the number of sessions completed by this participant
count = await psychoJS.shelf.getDictionaryFieldValue({key: ["participation-cap"], fieldName:group, defaultValue:'no sessions detected'});
count = count + 1;
if ((count > Number.parseInt(expInfo["participation limit"]))) {
capped = true;
cappedText = (("Thank you for your interest in this study. Unfortunately the " + group) + " group is now full.");
}
else {
psychoJS.shelf.setDictionaryFieldValue({key: ["participation-cap"], fieldName: group, fieldValue :count});
cappedText = (((("Hi there, you are participant " + count) + " in the ") + group) + " group.");
}
psychoJS.experiment.addData("Count", count);
Basically, I want to achieve the same as you did in the demo. I want to assign participants to groups according to their score on a subscale of my survey OCI12 (which is the score on the washing_scale). I only want a certain number of participants per group and once the group is full, the experiment should terminate for other participants with those scores.
In the end I plan to add more groups not just low risk and high risk, but I think this will be easier to achieve once I fully grasped the function of the shelf. The washing_scale can range from 0 to 12 and I want to have a group of 20 participants for each of the scores.
I hope this information helps let me know if you need more. Thank you for your efforts!