- Posts: 7
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Randomly display certain groups of questions
- lamjas
- Topic Author
- Offline
- New Member
Less
More
9 years 8 months ago #111780
by lamjas
Randomly display certain groups of questions was created by lamjas
Hi there,
My study is a longitudinal study and I have collected several waves of data. So, all participants have their own token.
In the next wave, I want to have two versions of surveys. Certain "optional" groups of questions will be randomly shown to participants.
For example, I have 10 groups of questions (G1-G10). G1 to G6 are core questions and everyone should answer them. Thus, one group of people will see G1-G8, while another group will see G1-G6 and G9-G10.
In my study, many people have been dropped out. But, I will still send invitation to them anyway. I don't want to create two surveys and randomly assign participants to one of the versions as the number of participants may not be approximately equal to each other at the end. I want to create one survey only and let LS to randomly assign for me so that the probability is half-half all the time.
Is it possible to do this?
My study is a longitudinal study and I have collected several waves of data. So, all participants have their own token.
In the next wave, I want to have two versions of surveys. Certain "optional" groups of questions will be randomly shown to participants.
For example, I have 10 groups of questions (G1-G10). G1 to G6 are core questions and everyone should answer them. Thus, one group of people will see G1-G8, while another group will see G1-G6 and G9-G10.
In my study, many people have been dropped out. But, I will still send invitation to them anyway. I don't want to create two surveys and randomly assign participants to one of the versions as the number of participants may not be approximately equal to each other at the end. I want to create one survey only and let LS to randomly assign for me so that the probability is half-half all the time.
Is it possible to do this?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10104
- Thank you received: 3593
9 years 8 months ago - 9 years 5 months ago #111784
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Randomly display certain groups of questions
You can load an
equation type question
(code "random1") with a random number between 1 and 2:
The relevance for groups 7 & 8:
The relevance for groups 9 & 10:
.
Code:
if(random1 > 0, random1 , rand(1, 2))
The relevance for groups 7 & 8:
Code:
random1 == '1'
The relevance for groups 9 & 10:
Code:
random1 == '2'
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 5 months ago by tpartner. Reason: Typo in code
The topic has been locked.
- lamjas
- Topic Author
- Offline
- New Member
Less
More
- Posts: 7
- Thank you received: 0
9 years 7 months ago #111845
by lamjas
Replied by lamjas on topic Randomly display certain groups of questions
Hello again,
As I am new for version 1.92+, I need some time to make sure I understand your solution.
However, I tested the activated survey after inserting the solution, but only G7-G8 (random == '1') are always shown. I never saw G9-G10. Could you please kindly check my setting. I am not sure what goes wrong. Thanks very much for your help.
(1) I created a hidden equation type question (code "random1") in G1 and stated the equation if(random1 gt 0, random1, rand(1, 1)) using "Source" button. By default, the relevance equation becomes "1" after choosing "equation" type question.
(2) In G7 and G8 Group Relevance (not each questions on G7 and G8), I stated random1 == '1' (note: the color of random1 becomes brown)
(3) In G9 and G10 Group Relevance, I stated random1 == '2' (again, the color of random1 is brown).
As I am new for version 1.92+, I need some time to make sure I understand your solution.
However, I tested the activated survey after inserting the solution, but only G7-G8 (random == '1') are always shown. I never saw G9-G10. Could you please kindly check my setting. I am not sure what goes wrong. Thanks very much for your help.
(1) I created a hidden equation type question (code "random1") in G1 and stated the equation if(random1 gt 0, random1, rand(1, 1)) using "Source" button. By default, the relevance equation becomes "1" after choosing "equation" type question.
(2) In G7 and G8 Group Relevance (not each questions on G7 and G8), I stated random1 == '1' (note: the color of random1 becomes brown)
(3) In G9 and G10 Group Relevance, I stated random1 == '2' (again, the color of random1 is brown).
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10104
- Thank you received: 3593
9 years 7 months ago - 9 years 7 months ago #111853
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Randomly display certain groups of questions
Sorry, a typo in my solution...
This:
Should be changed to:
.
This:
Code:
if(random1 gt 0, random1, rand(1, 1))
Should be changed to:
Code:
if(random1 gt 0, random1, rand(1, 2))
.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 7 months ago by tpartner.
The topic has been locked.