Welcome to the LimeSurvey Community Forum

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

Rand(1,n) leads to unequal assignment of conditions?

  • verena.distler
  • verena.distler's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 11 months ago #212276 by verena.distler
Hello,

We are currently conducting a study where participants are randomly assigned to one of 24 conditions. We used the following command (as described here: pages.shanti.virginia.edu/polpsych/2012/...1/random-assignment/ ):

{if(is_empty(random),rand(1,24),random)}

This seems to be working fine when testing qualitatively. However, when conducting the study with 120 participants (where we would expect 5 participants per condition approximately), we end up with 10 participants in one condition, and only 2 in another condition. I am aware that rand(1,24) will calculate a pseudorandom number, and that slight differences in sample size per condition are possible, but this large discrepancy between 2 and 10 (rather than numbers closer to 5) is surprising and problematic for our study setup. I now tested the survey with 60 more answers, where the groups were unequally distributed again, with some conditions never being assigned to a participant. We are worried that the problem might persist even with larger sample sizes. What could be the problem? How could we try to fix this?
 
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago #212278 by Joffm
What do you expect?
It is a random number.
And did you check the 95% intervall of confidence in a statistic table like "Geigy".
For n=120 and x=5  it is 1.75 -.12.44. 
So your distribution is quite normal.

I did a quick check with the random number in EXCEL and got this
 

You may try in EXCEL with 1200 numbers. Of course the absolute differences from the 50, 50, 50,... distribution will be higher, but the difference of percentage will be lower.
For n=1200 and x=50  the 95% intervall of confidence is 33,5 -.64.9. 

In the German part I wrote something about alternatives to this random number.

And what you do if one group is full but there are only a few participants in another one?
Switch the relevance equations.
If you start with (random number 1 - 4)
G1: random==1
G2: random==2
G3: random==3
​​​​​​​G4: random==4

Now, let's say G2 is filled, but you need participants in G4
Just change to
G1: random==1
G2: random==0 (unpossible
​​​​​​​G3: random==3
​​​​​​​G4: random==4 or random==2

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, tpartner, verena.distler
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 11 months ago - 3 years 11 months ago #212292 by Joffm
Hi,
a bit more mathematics.

The formula to calculate the probability of x outcomes in 120 events with this scenario (1-24) is:
 

With a macro in Excel I calculated all possible outcomes from 1 ( meaning X appears only once ) to 120 ( meaning X appears 120 times)
And here it is (the first 20)
 

This shows: The probability of exactly 5 times is only about 18%.

And of course there is a probability to get each time of the 120 tries the same number.
It is really small, but still greater than 0.
 

Here the last ten
 


By the way:
The probability to get 12 times a "6" when rolling a dice, is 0,000000000459
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 11 months ago by Joffm.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose