Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Balanced assignment of participants into groups

  • JanVor
  • JanVor's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago - 4 years 1 month ago #194780 by JanVor
Hi!

I have the following use case and I am unsure how to realize it:

My study has several conditions.
Participants click on the survey and get assigned to a group.
I want my study to take 60 participants which are equally distributed into these two groups.

I.e: randomly assign a participant to a condition. Is the condition full but another condition is missing people, move them to the other condition.

I currently have an equation after the informed consent that randomly assigns a number to the participants. However, I don't know how I can manage it, so that I don't end up with 59 people in group A and 1 person in group B (for example).

I thought about using quotas but with them I seem to only be able to either end the study or have participants manually choose another answer, both of which is suboptimal.

Another way would be with extending the javascript that creates the random number by checking how many people of a certain group have completed the questionnaire, but I do not know how I can have a survey question access the database.

Has anybody done this before? Am I missing a completly obvious solution?

I have attached the survey lss just in case.

Best wishes and thanks!
Jan
Last edit: 4 years 1 month ago by JanVor. Reason: Made a few things clearer
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #194781 by tpartner
Accessing previous results won't help as at any time you may have several respondents in a given group who have not completed the survey yet.

The only sure way to do it is to monitor the data and adjust the group relevance manually.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: JanVor
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago - 4 years 1 month ago #194785 by Joffm
Hi,
first the mathematics.
If you do this experiment ("A" or "B") 60 times, the probability that you get a result between 25/35 and 35/25 is about 94% with less 25/35 and more 29/31 and most 30/30.
That's Bernoulli.

Now some solutions:
1. The easiest at all:
Wait until both groups are filled. Remove randomly some respondents from the overquota group.

2. the easy ones:
You have two groups ("A" and "B").

a.You create a random number (1,2) with the relevance equations:
A : randnumber==1
B: randnumber==2

After one of the two groups is full (let's say A), you change the relevance equations to:
A : randnumber==0
B: (randnumber==1) OR (randnumber==2)

The same effect: You change the equation where you create your random number
from {if(is_empty(randnumber),rand(1,2),randnumber)}
to {2}.

b. You create a random number between 1 and 100
{if(is_empty(randnumber),rand(1,100),randnumber)}
Initially you set the relevance equations to
A : randnumber<51
B: randnumber>50

If you encounter a disbalance you can finetune to
A : randnumber<71
B: randnumber>30
So more respondents are thrown to group A.

Remember: This all is only a changing of text, which can be done while the survey is active.

3. Now the sophisiticated part, which will do this automatically. (if you have access to the database)
Use an ajax call and in the called php script query the database to find the least filled group.


Unfortunately the quota management of LimeSurvey is a bit simple. There is no access to something like "quota_target", "quota_Todo" or so.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 4 years 1 month ago by Joffm.
The following user(s) said Thank You: JanVor
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago - 4 years 1 month ago #194786 by holch
If I recall right, one user implemented a "least filled bucket" system for their Limesurvey installation, but I don't really remember who it was and how they did it. And I don't think they published their approach with code.

All in all I would guess that a fully automated approach would require some significant custom coding.

Here also the link I was referring to: www.limesurvey.org/es/foro/can-i-do-this...er-all-needed-solved

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 4 years 1 month ago by holch.
The following user(s) said Thank You: JanVor
The topic has been locked.
  • JanVor
  • JanVor's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 1 month ago #194787 by JanVor
Thank you everybody.

I guess monitoring the filling of the groups and adjusting the randomizer manually should the need arise will be best for our approach... at least until I learn how to deal with database calls.


Best wishes,
Jan
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago - 4 years 1 month ago #194791 by tpartner
A database query still does not address the problem of respondents who have not finished the survey yet.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 1 month ago by tpartner.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 1 month ago #194807 by holch

A database query still does not address the problem of respondents who have not finished the survey yet.


Of course. But if you have the time to manually adapt the formula, there isn't probably that much traffic on the survey anyway.

Because if you really have several respondents at the same time on a regular, your buckets are probably filled quite quickly anyway.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose