Welcome to the LimeSurvey Community Forum

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

Assign participants to 2 different question groups (treated and controls)

  • dgiacometti
  • dgiacometti's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #137058 by dgiacometti
Is it possible to randomly assign participants to two different question groups?

Basically, half of the subject pool must take a path and the other half another (randomly). At the end of the survey I will have a treated group and a control one.

How can I do that?

Thank you in advance.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137061 by holch
This has been answered just this week. Searching for "random" in the forum will give you this:

www.limesurvey.org/forum/search?query=random&childforums=1

The first entry is your question, the second should give you what you need, it is basically the same case:
www.limesurvey.org/forum/design-issues/1...ment-of-question-a-b

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

The following user(s) said Thank You: Elodie_Auer
The topic has been locked.
  • dgiacometti
  • dgiacometti's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #137082 by dgiacometti
Do I really have to import a file? It is not possible to do that through the interface of Limesurvey?

(I am very new to programming...)
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137104 by holch
No, you don't necessarily have to import a file. You need to read the whole thread. There you will see that I posted a code that you need to put into an equation type question:
www.limesurvey.org/forum/design-issues/1...-question-a-b#136613

You'll probably need something like:

Code:
{if(is_empty(G1Q1),floor(rand(1,2)),G1Q1)}


However, I also attached an LSS file which is a survey file that you can import as a new survey and have a look how it is done. Because of course the code posted above needs to be adapted to your questions codes. It is a working example of the code that I posted. So it makes sense to import it, have a look at it how it is done (one equation question with the code above that generates a random number (in this case either 1 or 2). Then you use relevance equations to hide and show certain questions accordingly. At the end of testing, when everything works well you will hide the equation question.

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

The topic has been locked.
  • dgiacometti
  • dgiacometti's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #137120 by dgiacometti
So, if my understanding is correct I have to do the following (probably is not :S ).

I have to add an hidden question that is an equation type question. And then to conditionally attach one of the two paths at the equation.

Now suppose I have already created the two groups of questions.
The only common part is the welcome page at the beginning, then the questionnaire can randomly take one of the two paths (this is what I am trying to do).
The first group is called Treated Group and coded TG1, TG2, TG3, et cetera... .
The second group is called Control Group and coded CG1, CG2, CG3, et cetera... .
Some parts in both groups are common but I already copied them, so that they are independent.


To summarize, I have to add the code you suggested in the following way?

{if(is_empty(TreatedGroup),floor(rand(1,2)),TreatedGroup)}

Does this randomly assign the participants to the two groups of questions?

Then I have to change also the relevance of all the questions of the two groups? Or is it sufficient?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137129 by holch
As you guessed, it is wrong. :-)

You need to have the equation question before the two groups, otherwise it won't work.

Lets say you will create the equation question and give it the question code "Q1".

Then you put this code into the equation question:
Code:
{if(is_empty(Q1),floor(rand(1,2)),Q1)}

What does this code do? It checks if the equation question Q1 has been triggered already and already has a random number set (isempty(Q1)). If it is empty, then it will create a random number of 1 or 2. However, if the random number is already set in the question Q1, then it will do nothing, but just use its own value. Why so complicated? why not only use {floor(rand(1,2))} to create a random number? Because then whenever the equation is triggered a new random number is created, which of course we wouldn't want. We want it to be set once the first random drawing was done.

Then in the following question, in your case the groups actually, you insert in the relevance equation of the respective groups something like {Q1==1} to show/hide the group when Q1==1, e.g. for the treated group, and {Q1==2} to show/hide the control group.

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

The topic has been locked.
  • dgiacometti
  • dgiacometti's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #137151 by dgiacometti
Thank you very much for this quick course. :)

I tried doing what you suggested.

I added another group before Treated and the Control.

Added the Q1 equation question. Specified the code you gave.

Then in the two groups I have set the relevance {Q1==1} for the treated group and {Q1==2} for the control.

I tried to preview the questionnaire and after the entering question (to make sure you are not a machine) I get the welcoming message.

Afterward If I press ok/move on I get again the welcoming message. Again and again.

I must have done some mistake again.

Could you help me?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 9 months ago #137164 by holch
can you upload a LSS file? Otherwise it is difficult to guess what you did wrong.

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

The topic has been locked.
  • dgiacometti
  • dgiacometti's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #137234 by dgiacometti
When I try to download the survey structure in the ssl format it donwloads it in the ssl.xml format.

Consequently, I cannot upload it here...

Do I need anything special to download in the ssl format? Or do I have to change any setting?
The topic has been locked.
  • dgiacometti
  • dgiacometti's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #137235 by dgiacometti
Sorry, of course I was referring to a lss file (not ssl).
The topic has been locked.
More
7 years 9 months ago #137237 by Ben_V

dgiacometti wrote: When I try to download the survey structure in the ssl format it donwloads it in the ssl.xml format...

Mac user? check this previous post

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: holch
The topic has been locked.
  • dgiacometti
  • dgiacometti's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
7 years 9 months ago #137295 by dgiacometti
There you are and thank you for the support. What am I missing? What do I have to change?
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose