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

More
3 years 3 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.

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
3 years 3 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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
3 years 3 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...)

Please Log in or Create an account to join the conversation.

More
3 years 3 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:

{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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
3 years 3 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?

Please Log in or Create an account to join the conversation.

More
3 years 3 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:
{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'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
3 years 3 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?

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #137164 by holch
can you upload a LSS file? Otherwise it is difficult to guess what you did wrong.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
3 years 3 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?

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #137235 by dgiacometti
Sorry, of course I was referring to a lss file (not ssl).

Please Log in or Create an account to join the conversation.

More
3 years 3 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

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #137295 by dgiacometti
There you are and thank you for the support. What am I missing? What do I have to change?
Attachments:

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #137300 by holch
Hmm, I hoped that you wouldn't give a survey with more than 60 questions, but only the part with the problem.

First aspect: I think you put the equation in the wrong place. I moved it and made the question visible and this works now (either 1 or 2 is randomly assigned to the equation question Q1). Unfortunately when you click on next, you reach the end (with non of th other questions shown). So there seems to be another problem. I will investigate further.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #137301 by holch
OK, here we go. Problems solved.

Problem 1: You had the expression at the wrong place. It needs to be placed as "question text" to be saved in the database.
Problem 2: You had the relevance equations for the two groups in brackets {}. Limesurvey highlighted this error marking it red. I don't know why, but the code for the expressions needs to be in between { and }, but for the relevance equations it shouldn't. Probably because you can use the expressions within normal text, etc., while the relevance equations just can contain EM code. I would find it more logical if we would use brackets for relevance equation as well, but that's the way it is.

What I did was showing the question Q1 to check if the randomization is working, which is where I discovered the first problem. Once that was fixed, with the equation question showing I could see if it works correctly. I would highly recommend to work with all questions showing at the beginning and once you know it is working correctly (e.g. when the number 1 shows up, the right group of question is shown, etc.), then I would hide the question and test again if it still works fine. Then I would even activate the survey and make a few tests and see in the database if the questions asked correspond to the value of Q1, just to make sure everything is working fine. With the question hidden, you can't see what is actually happening.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Attachments:

Please Log in or Create an account to join the conversation.

More
3 years 3 months ago #137323 by dgiacometti
First of all I would like to thank you very much for your help. This project is particularly important for me.

Thank you !

I charged the survey and then tried to run it as a preview.

I have now some problems:

1. In the welcoming page in the title, before the usual title there is this word "[external]" just before it. Why is that? Can I just take it out?

2. I tried to run the survey and it seems the program does not randomize between the treated group and the control. Indeed, it looks like the program only show me the TREATED GROUP questions. Possibly there is something still missing?

3. You suggested to activate the survey to run some tests. Isn't it a problem? It says that if I do that I will not be able to add or delete any questions afterwards.... . Maybe I can easily solve this problem re-charging another survey? :huh:

4. If my understanding is correct you suggest to keep the initial question (after the welcoming page) not hidden and run some tests. I am right? To do that I just have to unflag the hidden question button, right?

Thank you again.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!