# Welcome to the LimeSurvey Community Forum

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

# Randomly Select Question Groups

6 years 11 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.
The topic has been locked.
6 years 11 months ago #145898 by holch
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.

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.
6 years 11 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.
The topic has been locked.
6 years 11 months ago #145901 by holch
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 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.
6 years 11 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.
The topic has been locked.
6 years 11 months ago #145950 by tpartner
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.
Code:
`{sum(Q2.relevanceStatus, Q3.relevanceStatus, Q4.relevanceStatus, Q5.relevanceStatus)}`

3) Place relevance on the visible questions, referencing their corresponding equation questions something like this:
Code:
`equation1 LT 3`

Sample survey attached:

#### File Attachment:

File Name: limesurvey...4146.lss
File Size:22 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: holch, Jane
The topic has been locked.
6 years 11 months ago - 6 years 11 months ago #145952 by holch
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.

The topic has been locked.
6 years 11 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.
6 years 11 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?
The topic has been locked.
6 years 11 months ago #145992 by DenisChenu
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.

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.
3 years 8 months ago - 3 years 8 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:
Code:
`{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

#### File Attachment:

File Name: limesurvey...4146.lss
File Size:28 KB
Attachments:
The following user(s) said Thank You: Matherion
The topic has been locked.
3 years 8 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.
The following user(s) said Thank You: Matherion
The topic has been locked.