# Group Relevance vs Relevance Equation Problem

1 Monat 2 Wochen her #194474 von yagmurkiper
Hello everyone,

I designed an experiment that has 8 different groups each of which includes 136 items. Each group needs to be assigned to different people randomly, which is easy thanks to group relevance feature on LimeSurvey.

To randomize the groups, I wrote the codes below on group relevance parts for each group as illustrated below:

Group 1: ((random == 1))
Group 2: ((random == 2))
.
.
.
Group 8: ((random == 8))

However, I did not know the difference between the group relevance and the relevance equation under each item, so to ensure that I did not make any mistakes and I could randomize the lists, I also wrote the group relevance code of a group into each item of the same group as can be seen below:

In other words, if Group 1 has this ((random == 1)) as group relevance code, each item in Group 1 has the same code under their relevance equation parts, which was actually a bit of a waste since basically I misunderstood what relevance equation is and writing a code under group relevances would help me randomize the experiment, but it was too late when I figured this out.

This was the summary of how I organized the experiment. It actually worked and everything was fine. I am now collecting data, but I have another problem that I want to link here, the things I have written above.

As far as I have learned from the forum, LimeSurvey does distribute the groups randomly but not equally. One group of mine has 25 participants, but the other has 16, which is a problem for me because I want them to be as equal as possible.

Fortunately, one person from the forum also helped me with this problem and suggested that I put zero under the group relevance part of the group that I do not want to be distributed anymore.
I did this as you can see in the picture below:

However, this solution did not work for me. After putting zero, a participant managed to do the experiment on the group I thought I deactivated.

What can the problem be? Is it because of the relevance equation codes in each item in this group because I did not put zero in them and kept ((random == 5)) as it would take a lot of my time?

Thank you so much for your time and bearing with this long text.
##### Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
1 Monat 2 Wochen her #194476 von Joffm
First, if you set the group relevance it is not necessary to set the same to each question of the group.
Something like this may be of interest, when the group is showed to all male respondents, and within the group some questions are only displayed to old respondents, other to young respondents.
Just for clarification.

As far as I have learned from the forum, LimeSurvey does distribute the groups randomly but not equally. One group of mine has 25 participants, but the other has 16, which is a problem for me because I want them to be as equal as possible.

This is the behaviour of each random number calculation. Your sample is just too small, only 43 cases
If you wait till you have ten times that amount of respondents you will see, that you won't get a distribution of 250 and 160, but a much better 50/50 distribution
On the other side a difference of nine respondents seems to be a lot with a sample of 43, but not in a sample of 430.

Okay, now the solution.

Fortunately, one person from the forum also helped me with this problem and suggested that I put zero under the group relevance part of the group that I do not want to be distributed anymore.

I do not think that anybody suggested this.
If you just set the group relevance to "0", what happens with respondents who got the random number of this group?

No, you have to set the relevance equation accordingly. Like this (only three groups)
1. Let's say you want to get 40 cases in each group.
Actual distribution.
Group 1: 25 cases
Group 2: 16 cases
Group 3: 20 cases

I always recommend, not to set the equation to select the random number to rand(1,3), but to rand(1,100)
Group 1: random<25
Group 2: random>24 and random<65
Group 3: random>64
Here the chance of group1 to be selected is only 25%, the chance of group 2 40%, and of group3 35%.
This is one way to adjust.

2. In case your first group is filled. Do not set the relevance of a group to "0", but set (in case you have "rand(1,3)"
Group 1: random==0
Group 2: random==2
Group 3: random==1 or random==3
This way nobody will enter group 1, but 33% will enter group 2 and 66% group 3.

3. You use a least filled approach. This is a more sophisticated way.
Use an ajax call to count the persons in each group so far and to give you the group with the least amount.

Joffm

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

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her #194478 von yagmurkiper
Dear Joffm,

Thank you so much for your valuable comment. I tried the second option, put ((random==0)) under my Group 5 that has enough participants and I put its code under Group 6 as in the picture:

10 people opened the experiment after this arrangement and it seems to be working because noone has been assigned to Group 5, but unfortunately same is valid for Group 6, as well although its randomization possibility is higher than others right now since it has two codes.

Why do you think both of my groups seem to be deactivated? Is there something wrong with the group relevance on the picture?

Thank you so much again. I am grateful for your help.
##### Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her #194480 von Joffm
Do it accordingly.

But: Show at least ALL of your groups, the number of participants in each group,
not only a little bit.

Joffm

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

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her - 1 Monat 2 Wochen her #194481 von yagmurkiper
Here is the current situation of my experiment. The first two-digit number is how many people did that list and the codes are my arrangement after I read your instructions:

List 1: 18 ((random==1))
List 2: 19 ((random==2))
List 3: 21 ((random==3))
List 4: 22 ((random==4))
List 5: 25 ((random==0))
List 6: 18 ((random==5)) or ((random==6))
List 7: 23 ((random==7))
List 8: 18 ((random==8))

Although this needs to be working now, the last person assigned to List 5 did not see any items and the experiment finished immediately after she filled in her demographical information part (whose relevance is 1 since everyone has to do this part), but I expected that participant to see the items of List 6 as List 5's code belongs to List 6 now. That did not happen.
Something is wrong but I cannot figure out what it is.

Am I still making a mistake?
Letzte Änderung: 1 Monat 2 Wochen her von yagmurkiper.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her #194490 von Joffm
As far as I can see, this is correct.
IF these are the settings of your group relevance equations.
And your equation to set the random number is called "random" and the question text is
{if(is_empty(random),rand(1,8),random)}

Wher is the equation to calculate the random number.

Create a prototype with the same structure and the same settings.
1. Demographical.
2.-9. The eight groups (only containing a text display question)
10. A last group.

Here you may try and see if there is any mistake in your settings.

Joffm

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

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her #194496 von yagmurkiper
These are my groups:

The first one includes demographical information questions and as its relevance is 1, everybody sees that and after that, they are distributed to different lists.

I also put my equation into the demographical info group as in the picture:

and wrote the code as below:

I did not write a long code as you suggested. I hope that was not a problem.

I am just wondering whether the problem is that I did not get rid of the relevance equation in each item in List 5 (each has ((random==5))).

I will try to create a prototype to see what went wrong.

Thank you so much again.
##### Anhänge:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her #194516 von DenisChenu
Never use rand without a test before ...

random question MUST be
{if(empty(self.NAOK,rand(1,8),self.NAOK)}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her #194521 von yagmurkiper
I see. Can I ask what is the difference between {if(empty(self.NAOK,rand(1,8),self.NAOK)} and rand code that I wrote?
Why should I not use it before a test?

I am asking because I do not know much about writing codes so I am just curious.

Thank you so much!

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her - 1 Monat 2 Wochen her #194523 von Joffm
Sorry, I thought you knew that. It is discussed many, many times here.
An equation is fired each time a page loads.
So a simple "rand(x,y)" will always create a different result.
This may happen, if the respondents goes back in the questionnaire, there are other questions in the group, setting "group by group", etc.
To avoid this you better use the construct
{if(is_empty(random),rand(x,y),random)}

" if the random number is still empty, create one, otherwise leave as it is".

By the way:
This behaviour (change the random number on each page load) is the same as in EXCEL and others.
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Letzte Änderung: 1 Monat 2 Wochen her von Joffm.
Folgende Benutzer bedankten sich: DenisChenu

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

1 Monat 2 Wochen her #194524 von yagmurkiper
Thank you so much! This is some valuable piece of information for me. I had to prepare the experiment very quickly in a limited period of time and since I really know nothing about coding, I could not find a chance to dig into the manual or read the forum in detail, which is something I regret now.

I already ran the experiment and used the rand code, so changing the code to what you recommended worries me a little bit. I do hope there won't be any problem.

Next time I prepare an experiment here I will try this code and see how it works.