Welcome to the LimeSurvey Community Forum

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

Random allocation to each condition without replacement

  • mehmetbicakci
  • mehmetbicakci's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 1 month ago - 2 years 1 month ago #236320 by mehmetbicakci
Please help us help you and fill where relevant:
Your LimeSurvey version: LimeSurvey Community Edition  Version 5.3.32+220817
Own server or LimeSurvey hosting: own hosting
Survey theme/template: fruity
==================

Hello everyone.
I've been having a crisis for the last three days. I am trying to construct a relatively simple survey structure, but I do not know how to use detailed functions. 

My problem is simple as this: generating random numbers without replacement.

For example, assume these are in a magician trick hat :) 1,2,3,4,5,6. In the first selection, my possibilities to select any of them are random. Assume that I picked the 2 in the first operation. There should be left the others, 1,-,3,4,5,6. I am excepting establishing this procedure where all 6 numbers are drawn. After that, I want to redo this process starting from the 7th participant.

1. Participant: Randomly allocated 1 of the 6 groups. (assume that it is 3; SO, 3 will not be included in the next random number generation process)
2. Participant: Randomly allocated to 1 of the 5 groups (assume that it is 2).
3. Participant: Randomly allocated to 1 of the 4 groups (assume that it is 4, There is no repetition, as you can see)
4. Participant: Randomly allocated to 1 of the 3 groups (assume that it is 1)
5. Participant: Randomly allocated to 1 of the 2 groups (assume that it is 6)
6. Participant will be allocated to the ONE EMPTY CONDITION: 5

AFTER COMPLETION, A NEW 6-PACK SHOULD BE OPEN
After that;

7th participant is randomly allocated to one of the 6 groups.....

Additionally,  I want to do it separately for each different 4 language group, but still...

Currently, I am using: 

0. {SAVEDID-6*floor((SAVEDID-1)/6)} (conditioned with 6 questions listed below)

1. random number generation (floor(rand(1,6.9999)) for allocation 
2. random number generation (floor(rand(1,6.9999)) for allocation
3. random number generation (floor(rand(1,6.9999)) for allocation
4. random number generation (floor(rand(1,6.9999)) for allocation
5.random number generation (floor(rand(1,6.9999)) for allocation
6.random number generation (floor(rand(1,6.9999))for allocation

surveys:

SET 1
1. if the result of the random number generator 1 is 1, show this survey
2. if the result of the random number generator 1 is 2, show this survey
3. if the result of the random number generator 1 is 3, show this survey
4. if the result of the random number generator 1 is 4, show this survey
5. if the result of the random number generator 1 is 5, show this survey
6. if the result of the random number generator 1 is 6, show this survey

SET 2 
1. if the result of the random number generator 2 is 1, show this survey
2. if the result of the random number generator 2 is 2, show this survey
3. if the result of the random number generator 2 is 3, show this survey
4. if the result of the random number generator 2 is 4, show this survey
5. if the result of the random number generator 2 is 5, show this survey
6. if the result of the random number generator 2 is 6, show this survey

SET 3
1. if the result of the random number generator 3 is 1, show this survey
2. if the result of the random number generator 3 is 2, show this survey
3. if the result of the random number generator 3 is 3, show this survey
4. if the result of the random number generator 3 is 4, show this survey
5. if the result of the random number generator 3 is 5, show this survey
6. if the result of the random number generator 3 is 6, show this survey

SET 4
1. if the result of the random number generator 4 is 1, show this survey
2. if the result of the random number generator 4 is 2, show this survey
3. if the result of the random number generator 4 is 3, show this survey
4. if the result of the random number generator 4 is 4, show this survey
5. if the result of the random number generator 4 is 5, show this survey
6. if the result of the random number generator 4 is 6, show this survey

SET 5
1. if the result of the random number generator 5 is 1, show this survey
2. if the result of the random number generator 5 is 2, show this survey
3. if the result of the random number generator 5 is 3, show this survey
4. if the result of the random number generator 5 is 4, show this survey
5. if the result of the random number generator 5 is 5, show this survey
6. if the result of the random number generator 5 is 6, show this survey

SET 6
1. if the result of the random number generator 6 is 1, show this survey
2. if the result of the random number generator 6 is 2, show this survey
3. if the result of the random number generator 6 is 3, show this survey
4. if the result of the random number generator 6 is 4, show this survey
5. if the result of the random number generator 6 is 5, show this survey
6. if the result of the random number generator 6 is 6, show this survey

If I change the random number generation base for the following participant IDs, for example, (floor(rand(2,6.9999)), (floor(rand(3,6.9999)) .... (floor(rand(5,6.9999)), There will be a repetition in randomness. For example, the First participant and sixth participant could get the 6th survey because of the no-limitation problem in the first place.

If I delete the surveys starting from the second set (for example, 1st survey in the first, 1st, and 2nd in the 3rd set, and so on and so on. The above described problem arises again.

I am stuck...
I  will be very happy if you help me. 
Best regards,
Last edit: 2 years 1 month ago by mehmetbicakci.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 1 month ago #236324 by Joffm
So, to make it simple:
This is nothing else than randomly distributing the first six participants to six groups.
Then do it again with the next six.

This is not so very easy.
You have access to the previous responses in total (plugin "statFunctions"), but not to the latest one.
What is the latest? The latest started, the latest submited?

And you have to deal with terminations. 
As in your example:
Participant 3 is allocated to group 4; but he decides not to complete the survey.
But in the meantime your participant 4 is already allocated to group 1.
What do you want to happen?

And as you - I think so - have no influence on the order of the perticipants, you get the same result by allocating like this:
Participant 1. Group 1
Participant 2. Group 2
...
Participant 6. Group 6
Participant 7. Group 1
Participant 8. Group 2
​​​​​​​You get the same random distribution.
​​​​​​​And this is possible by using the SAVEDID
But again you have to consider the terminations.​​​​​​​

And at the end you will get 1/6 of your participants allocated to each group.
This you may do easier by a simple random number 1-6 for each participant with the same result at the end of the survey.


But as you write

I've been having a crisis for the last three days. I am trying to construct 

I suppose you already created some ideas how to do this.
So please share them.

And just now there is another discussion about this.
Just a few days ago,.
[url] forums.limesurvey.org/forum/can-i-do-thi...-stable-distribution [/url]

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • mehmetbicakci
  • mehmetbicakci's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 1 month ago #236326 by mehmetbicakci
Dear Joffm, thank you so much for your reply.

This is a stalemate, so far. I am already using the information from that discussion.

Please check my post, I edited it with the current construction.

I dont know what is the most efficient way to achieve this. I cant control the participant order.

Is there any way to condition the random number generator? for example, {sum(previous responses in total.NAOK)-6*floor((sum(previous responses in total)-1)/6)}. The result of this equation is, for example, 3, then the generator will not generate the number 3. Thus, possibilities will be 1,2,-4,5,6.

Then, is there any code for limiting the survey to 1 participant at a time? Is it possible to have a system where participants are only admitted to the survey if the participant inside exits the survey? And there will be no "save and continue later" option. Still, it's a bit utopian and a system that would be beyond me.

Best regards,

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose