- Posts: 5
- Thank you received: 0
Randomly Select Question Groups
5 years 9 months ago #145897
by KMC
Randomly Select Question Groups was created by KMC
I see in the forums ways to randomly select individual questions. How have people set up to randomly select groups of questions?
I have 200 items in a pool, which are organized into 18 groups of questions. The question groups must remain intact. We want each participant to answer 6 groups of questions. We want all possible combinations of groups to be included in our large community sample.
I have 200 items in a pool, which are organized into 18 groups of questions. The question groups must remain intact. We want each participant to answer 6 groups of questions. We want all possible combinations of groups to be included in our large community sample.
The topic has been locked.
5 years 9 months ago #145898
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Randomly Select Question Groups
It is basically the same as for the questions. You need to create a random number. As you have 18 groups, you need to create a random number from 1-18 for example and then hide and show the question groups via relevance equation depending on this random number.
This is the easy part. Your problem is that you want to show 6 groups out of 18, not 1 out of 18. You could create 6 random numbers, but you would need to find a way so that each number can only be chosen once, because I assume that you don't want to show always the same 6 questions groups.
However, I remember that I have just seen a workaround by Olle this or last week on the forum, where you could draw X question randomly from a pool of questions. I think it was done by having 1 group with the number of questions to draw and another group with the rest of the questions. Then all those questions would go into the same randomization group. Obviously this workaround won't work with groups.
This is the easy part. Your problem is that you want to show 6 groups out of 18, not 1 out of 18. You could create 6 random numbers, but you would need to find a way so that each number can only be chosen once, because I assume that you don't want to show always the same 6 questions groups.
However, I remember that I have just seen a workaround by Olle this or last week on the forum, where you could draw X question randomly from a pool of questions. I think it was done by having 1 group with the number of questions to draw and another group with the rest of the questions. Then all those questions would go into the same randomization group. Obviously this workaround won't work with groups.
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.
5 years 9 months ago #145899
by KMC
Replied by KMC on topic Randomly Select Question Groups
Thanks Holch. I want to do something that doesn't seem to be supported the same way it is for questions.
I'm not sure if I understand. The number of random combinations of groups vastly exceeds 18, so if I were to enumerate each combination and using a relevance equation based on that random number it would be a awkward.
Yes, I am looking for a way to show only the 6 of the groups. That's exactly my problem.
It does look the the workaround that you cite is only relevant to selection or questions, which is not what need. I need to select groups.
I'm not sure if I understand. The number of random combinations of groups vastly exceeds 18, so if I were to enumerate each combination and using a relevance equation based on that random number it would be a awkward.
Yes, I am looking for a way to show only the 6 of the groups. That's exactly my problem.
It does look the the workaround that you cite is only relevant to selection or questions, which is not what need. I need to select groups.
The topic has been locked.
5 years 9 months ago #145901
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Randomly Select Question Groups
Yes, the workaround "as is" will only work for questions, because it requires groups.
I just thought you might be able to take this as inspiration. But I have my doubts that there would be a simple solution.
Somehow you would need to create 6 random numbers but you would need to guarantee that they are unique. The uniqueness is the main problem. Maybe someone who is a little more savy with programing finds a solution.
I just thought you might be able to take this as inspiration. But I have my doubts that there would be a simple solution.
Somehow you would need to create 6 random numbers but you would need to guarantee that they are unique. The uniqueness is the main problem. Maybe someone who is a little more savy with programing finds a solution.
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.
5 years 9 months ago #145902
by KMC
Replied by KMC on topic Randomly Select Question Groups
One thing I started to try was randomizing group order and then hiding the groups after the 6th group is presented.
I wasn't able to set a variable that would correctly count how many groups had preceded a particular group. To use that approach I initially set the variable to 1 in a fixed group at the start of the survey. Then I added an equation in each group that added 1 to that constant. I set relevance equations for each group to condition on that variable to remain below 7. However, I couldn't get the lime to count up to 7 as hoped.
I wasn't able to set a variable that would correctly count how many groups had preceded a particular group. To use that approach I initially set the variable to 1 in a fixed group at the start of the survey. Then I added an equation in each group that added 1 to that constant. I set relevance equations for each group to condition on that variable to remain below 7. However, I couldn't get the lime to count up to 7 as hoped.
The topic has been locked.
5 years 9 months ago #145950
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 Select Question Groups
You should be able to use the relevanceStatus variable something like as follows. (this example is for a 5-group survey, displaying only 3 groups)
1) Randomize the group order
2) In each group, precede the visible questions with a hidden equation question (equation1, equation2...) containing something like this (varies by group). The equation creates a sum using the relevanceStatus of questions in the other groups.
3) Place relevance on the visible questions, referencing their corresponding equation questions something like this:
Sample survey attached:
1) Randomize the group order
2) In each group, precede the visible questions with a hidden equation question (equation1, equation2...) containing something like this (varies by group). The equation creates a sum using the relevanceStatus of questions in the other groups.
{sum(Q2.relevanceStatus, Q3.relevanceStatus, Q4.relevanceStatus, Q5.relevanceStatus)}
3) Place relevance on the visible questions, referencing their corresponding equation questions something like this:
equation1 LT 3
Sample survey attached:
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
5 years 9 months ago - 5 years 9 months ago #145952
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Randomly Select Question Groups
Ha! I knew someone like Tpartner will come up with a solution!
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Last edit: 5 years 9 months ago by holch.
The topic has been locked.
5 years 9 months ago #145969
by KMC
Replied by KMC on topic Randomly Select Question Groups
Thanks. That does work. It's a painful workaround as we have several question pools (200+ items) that are still being developed with new items and items are being rearranged across groups. If the logic can be applied at the group level rather than at the time level, it would be a nice additional feature for limesurvey.
The topic has been locked.
5 years 9 months ago #145983
by KMC
Replied by KMC on topic Randomly Select Question Groups
TP,
We are running into what looks like idiosyncratic barriers on getting this implemented. We don't have the bandwidth to continue to learn/troubleshoot. Are you available for hire?
We are running into what looks like idiosyncratic barriers on getting this implemented. We don't have the bandwidth to continue to learn/troubleshoot. Are you available for hire?
The topic has been locked.
- DenisChenu
- Away
- LimeSurvey Community Team
Less
More
- Posts: 15235
- Thank you received: 2731
5 years 9 months ago #145992
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Randomly Select Question Groups
There are a little icon at bottom of tparter profile : www.limesurvey.org/component/uddeim/?task=new&recip=11021
Maybe you can use www.limesurvey.org/profile/emailuser?uid=11021 too.
Maybe you can use www.limesurvey.org/profile/emailuser?uid=11021 too.
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: tpartner
The topic has been locked.
2 years 6 months ago - 2 years 6 months ago #195973
by Jane
Replied by Jane on topic Randomly Select Question Groups
Thanks Tony!
A small improvement: you can also use the relevanceStatus of the equations in the other groups in each equation. For instance use in equation2:
Then you are independent of the other questions in the groups. Proof of concept:
survey.toolsforresearch.com/index.php/su...46/newtest/Y/lang/en
A small improvement: you can also use the relevanceStatus of the equations in the other groups in each equation. For instance use in equation2:
{sum(equation1.relevanceStatus, equation3.relevanceStatus, equation4.relevanceStatus, equation5.relevanceStatus)}
Then you are independent of the other questions in the groups. Proof of concept:
survey.toolsforresearch.com/index.php/su...46/newtest/Y/lang/en
Last edit: 2 years 6 months ago by Jane.
The following user(s) said Thank You: Matherion
The topic has been locked.
2 years 6 months ago #195991
by Jane
Replied by Jane on topic Randomly Select Question Groups
@tpartner I have written a blog entry on our site:
Limesurvey: Randomly show x out of y question groups
The equation question in each random group can be huge if there are a lot of groups in the Randomization group. At the moment we are speaking of 160 groups in the same Randomization group!
Is there a way to shorten that? Or even make the equation the same for each random group? I have already tried things like calculating the sum of all equation.RelevanceStatuses and subtracting the current equation.RelevanceStatus but did not succeed.
Limesurvey: Randomly show x out of y question groups
The equation question in each random group can be huge if there are a lot of groups in the Randomization group. At the moment we are speaking of 160 groups in the same Randomization group!
Is there a way to shorten that? Or even make the equation the same for each random group? I have already tried things like calculating the sum of all equation.RelevanceStatuses and subtracting the current equation.RelevanceStatus but did not succeed.
The following user(s) said Thank You: Matherion
The topic has been locked.
2 years 6 months ago #196022
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 Select Question Groups
Sorry, I can't think of anything within Expression Manager that will allow you to shorten it.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: Jane
The topic has been locked.
2 years 5 months ago #196692
by Matherion
Replied by Matherion on topic Randomly Select Question Groups
Because we're working on a survey with ~ 275 groups, I tried to find a way that's more scalable. By using the {self.gsec} variable and storing its value in an equation question within each group, and then checking whether that value is still lower than the desired number of questions (adding/subtracting what is needed given preceding groups), you eliminate the need to sum increasingly long strings.
In the example, there's a slider question resulting in a numerical value stored in {nrOfQuestions_nr}; every group contains a {group1seq} equation question that contains {self.gseq}; and all the questions in that group have as relevance equation {group1seq <= nrOfQuestions_nr} (in this example, the only preceding group is the one with the slider, and since {self.gseq} starts counting at 0, that works out nicely without the need for additional subtraction or addition).
I would have preferred this to be safer/more scalable/more maintainable by using as relevance equation {self.gseq <= nrOfQuestions_nr}, but for some weird reason that doesn't work. Anybody have any ideas why that could be? Shouldn't all values available in equation questions also work in relevance equations, since both use the expression manager?
I've attached an example survey that implements this.
In the example, there's a slider question resulting in a numerical value stored in {nrOfQuestions_nr}; every group contains a {group1seq} equation question that contains {self.gseq}; and all the questions in that group have as relevance equation {group1seq <= nrOfQuestions_nr} (in this example, the only preceding group is the one with the slider, and since {self.gseq} starts counting at 0, that works out nicely without the need for additional subtraction or addition).
I would have preferred this to be safer/more scalable/more maintainable by using as relevance equation {self.gseq <= nrOfQuestions_nr}, but for some weird reason that doesn't work. Anybody have any ideas why that could be? Shouldn't all values available in equation questions also work in relevance equations, since both use the expression manager?
I've attached an example survey that implements this.
The topic has been locked.