Welcome to the LimeSurvey Community Forum

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

Group randomisation

  • Sejtibbels
  • Sejtibbels's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228748 by Sejtibbels
Group randomisation was created by Sejtibbels
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 3.17.3+190429
Survey theme/template: Fruity
==================
Hi everyone,
I would like to randomly allocate participants to one of two groups. Therefore, I have created the hidden first question in order to then randomly assign participants to one of two conditions ({rand(1,2)}.
However, as I have already set a condition (for all questions) to ensure that participants can only respond if they have given their consent at the beginning of the questionnaire, it tells me that I cannot edit the relevance equation for the questions as I have already set out conditions. This is where I would have to type in ((random==1)) or ((random==2)).
Is there a way of adding this relevance equation elsewhere? In the “set conditions” menu for example?
Many thanks,
Sarah

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #228753 by holch
Replied by holch on topic Group randomisation
First of all, the formula for the random number is "wrong". Not wrong per sé, as it will generate a random number between 1 and 2. However, this will happen whenever this question is triggered, so the random number might change throught the survey, which I am sure is not what you want.

You should use something like (given that the equation question is called "random" based on your conditions that you show later):
[code]{if(is_empty(random.NAOK), rand(1,2), random.NAOK)}[/quote]

What does this do differently? It also creates a random number between 1 and 2, but only if there hasn't been set a number yet (if the equation question is still empty). If there has been created a random number previously, it will stick to this number. So the random number will be drawn once and then stay the same throughout the whole survey. Otherwise, it could happen that the random number is drawn again for the same respondent, which means you might have different random numbers throughout the survey.

Regarding the consent: I wouldn't do this via conditions, as you need to give EACH question a condition. I would use a zero quota (a quota that allows zero responses for a specific answer), this way you can easily "screen out" people who do give a certain answer (e.g. in your case that do not consent, but it could also be used if you only want male respondents and want to screen out all female respondents or the other way round. Just as an example).

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

Please Log in to join the conversation.

  • Sejtibbels
  • Sejtibbels's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228758 by Sejtibbels
Replied by Sejtibbels on topic Group randomisation
Thank you very much for getting back to me so quickly!

However, since I am technologically challenged I haven't fully understood your randomisation instructions...

Do I write exactly this (just below) in a hidden equation question at the beginning of the survey or do I need to modify part of it?

{if(is_empty(random.NAOK), rand(1,2), random.NAOK)}

Because it is telling me I have unidentified variables and I need to determine whether a variable is empty.

On a tutorial I found it seemed to suggest that I need to generate a random integer using Limesurvey Expression Manager...

Please Log in to join the conversation.

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #228760 by holch
Replied by holch on topic Group randomisation
Instead of {rand(1,2)} you write the code that I am posting.

"random" stands for the question code of this very specific question. If your's isn't called "random" than you need to adapt it accordingly.

But then the conditions that you mention later, e.g. (random==1) won't make any sense, as you refer to a question called "random" here.

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

Please Log in to join the conversation.

  • Sejtibbels
  • Sejtibbels's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 11 months ago #228762 by Sejtibbels
Replied by Sejtibbels on topic Group randomisation
Ok now that the code seems to work, which of the following do I need to write in the relevance equation: (I don't really understand what the .NAOK refers to)

((random.NAOK == 2 ))
OR
((random == 2 ))

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 11 months ago #228770 by Joffm
Replied by Joffm on topic Group randomisation
NAOK (meaning "No Answer is OK") is used to avoid the issue that a count or a sum of several objects fails if one of them isn't present (because of a filter, because of not answered)
[url] manual.limesurvey.org/ExpressionScript_-...ion/en#Usage_of_NAOK [/url]

So, adding ".NAOK" never is harmful, but not adding it might be harmful.

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: Sejtibbels

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose