Welcome to the LimeSurvey Community Forum

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

Random assignment to different experimental conditions

More
2 days 15 hours ago #274264 by daisybibi
Please help us help you and fill where relevant: 
Your LimeSurvey version: LimeSurvey Community Edition  Version 3.28.76
Own server or LimeSurvey hosting: university server
Survey theme/template:
==================Hello,
I am encountering a problem while setting up an experimental design in LimeSurvey, and after many tests I still cannot obtain the expected behavior. In fact, I want to:
  1. Display a first part (P1) containing several question groups that are common to all respondents. This block includes questions used to check respondent characteristics and exclude or keep them in the sample (e.g., age, AI usage, etc.).
  2. Randomly assign respondents to one of the four experimental conditions: Condition A, B, C or D. Each condition contains four question groups. In the end, I want to have the same number of respondents in each of the four conditions.
  3. Finally, display a third part (P3) containing two question groups that are identical for all respondents.
What I have implemented:
  • A “Internal variables” group placed right after Part 1
  • An equation question called 
    Code:
    randCondition
    with the equation:
    Code:
    rand(1,4)
  • An equation question called 
    Code:
    condition
    with the equation:
    Code:
    if(randCondition == 1, "B", if(randCondition == 2, "C", if(randCondition == 3, "D", "E")))
  • Conditions A, B, C or D for each group of questions with equations such as:
    • Code:
      condition == "B"
    • Code:
      condition == "C"
    • etc.
  • Block M without any condition
  • I also tried using quotas (BlocB, BlocC, BlocD, BlocE), but in my version of LimeSurvey quotas are necessarily blocking (only options are “Terminate survey” or “Allow the respondent to modify the last answers before terminating”), so it is impossible to use them to route respondents.
However, nothing works. Could you please tell me what is causing the issue or suggest another solution?
Thank you in advance. 

Please Log in to join the conversation.

More
2 days 1 hour ago #274271 by orvil
Hi, 
here is an example that hopefully helps. Plz see the attached example survey:This survey has 8 groups for better explanation:
  1. Group 1 holds a equation question (randABCD) for creating a random value between 1 and 4. It uses the ES {if(is_empty(Q1xRandom4), rand(1, 4), Q1xRandom4)} to keep the random value constant for all groups/questions!
  2. Group 2 holds one question for all participants
  3. Group 3 holds 4 questions, one to show for each random value, using the relevance equation {Q1xRandom4 == 1} and so on for each question
  4. Group 4a holds 2 questions for random value 1, using the relevance equation like above for the group
  5. Group 4b holds 2 questions for random value 2, same here
  6. Group 4c holds 2 questions for random value 3, same here
  7. Group 4d holds 2 questions for random value 4, same here
  8. Group 5 holds again a question for all participants. No relevance equation :)
BTW: To achieve a more even distribution (depending on the size of your sample) consider using e.g. rand(1,4000) for random creation and {(Q1xRandom4 >= 1 && Q1xRandom <=1000)} for relevance equations.

Cheers!
 

Best regards/Beste Grüße,
O. Villani

Please Log in to join the conversation.

More
2 days 1 hour ago - 2 days 1 hour ago #274273 by Joffm
Hi,
at first glance everything seems to be fine. So there seems to be some small hidden mistake.
Therefore you'd always send the lss export of your survey resp. the relevant parts


But one thing you should explain. What made you do this?
First you create a random number from 1-4. This means your "randcondition" will have one of these four values.
Now you do a second step to change these four numbers to letters in "condition".
And you use these letters to set the condition on the groups.

Why didn't you just use "randcondition"?
BlockA: randcondition==1
BlockB: randcondition==2
BlockC: randcondition==3
BlockD: randcondition==4

Here a small "skeleton" with your structure.

And the condition on the groups:
 


Unfortunately I can't send a sample. Your version 3.28. is already 3 and a half year old and not supported anymore.
I myself do not have an installation of this version on the machine I am working on at the moment.

Joffm

As see we prefer this construct to generate a random number:
{if(is_empty(self), rand(1,4),self)}
This avoids the behaviour that a random number changes each time there is a click in this group.
This is  usual behaviour. You can reproduce this in Excel as well.
Therefore this formula says: Only, if the random number is still empty it is created, otherwise it keeps the value.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 days 1 hour ago by Joffm.

Please Log in to join the conversation.

More
2 days 19 minutes ago #274274 by orvil
Does self work in version 3.x ? Gave it a try just now, had no success (V3.19). Expression returns 1 constantly. V6 however, replaces self with qcode

Best regards/Beste Grüße,
O. Villani

Please Log in to join the conversation.

More
1 day 23 hours ago #274275 by Joffm

Does self work in version 3.x ? Gave it a try just now, had no success (V3.19). Expression returns 1 constantly. 

Of course, it does. If it doesn't work, there is an error. But you did not show anything.

V6 however, replaces self with qcode

It does not replace with QCode. In the question summary it is shown what "self" and "that" do. That they expand to all subquestions.

respective the subquestions you select by a filter, like "self.sq_X".
Read the manual about it.

Joffm
 

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

Please Log in to join the conversation.

More
1 day 15 hours ago #274279 by daisybibi
A very big thank you for taking the time to reply and for the information you provided.
I actually realised that it wasn’t necessary to change those four numbers into letters, so I removed that step. I will change the construct to generate a random number and use the one you suggest.
The structure of my questionnaire is exactly the same as yours, and the conditions are identical as well.
Regarding the version, I am using the one provided by my university, which is indeed not the most recent.
I will look into all of this carefully over the weekend.
Best

Please Log in to join the conversation.

More
1 day 15 hours ago #274280 by daisybibi
A very big thank you for taking the time to reply and for the information you provided. Given how detailed and helpful your explanations are, I will take the time to look through your suggestions very carefully over the course of this weekend.
Best

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose