show n out of x questions and follow-up questions

More
5 months 4 weeks ago - 5 months 4 weeks ago #161857 by gsoto
gsoto created the topic: show n out of x questions and follow-up questions
I have 8 questions in a group. To each participant, 2 of the 8 questions should by shown at random. Also, for each of the 2 questions that are shown, a follow-up question should also be shown. I have arranged the questions in the following way:

q1
q1follow-up
q2
q2follow-up

q8
q8follow-up

I have tried the solution using relevanceStatus and a randomization group ( www.limesurvey.org/forum/can-i-do-this-w...stion-out-of-a-group ). For the follow-up questions, I have assigned the relevanceStatus of the "mother question" as relevance equation (so e.g. q1follow-up has a relevance equation of q1.relevanceStatus).

What works:
  • 2 of 8 questions are shown at random
  • the corresponding follow-up questions for the 2 randomly shown questions are also shown
What doesn't work:
  • the follow-up questions are shown in weird positions

Some of the question orders I have ended up with (A, B are the questions and a, b are the corresponding follow-up questions):
  • q4, q8, q4follow-up, q8follow-up (ABab) – this is the most frequent situation
  • q8, q6, q6follow-up, q8follow-up (ABba) – happens sometimes
  • q5, q1follow-up, q1, q6follow-up (AbBa) – happens rarely, but it's bad, because a follow-up question is shown before its "mother question"
The order I would like to always achieve:
  • q5, q5follow-up, q1, q1follow-up (AaBb) – each question is directly followed by its follow-up question
Can this be achieved with a minor tweak, or do I have to abandon the approach using relevanceStatus and a randomization group?
Last Edit: 5 months 4 weeks ago by gsoto. Reason: typo

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

More
5 months 4 weeks ago #161860 by Joffm
Joffm replied the topic: show n out of x questions and follow-up questions
Hi, gsoto,

to select randomly 2 out of 8 questions (with the follow up) you can do the following:
There are 28 ways to select 2 out of 8 (8 over 2).
1-2, 1-3, 1-4, 1-5 ,1-6 ,1-7, 1-8, 2-3, 2-4, 2-5, 2-6, 2-7, 2-8, 3-4, 3-5, 3-6, 3-7, 3-8, 4-5, 4-6, 4-7, 4-8, 5-6, 5-7, 5-8, 6-7, 6-8, 7-8
So you could create a random number (1-28) and display by relevance.
Like:
Q2, relevance equation: (randnbr==1) or (randnbr==8) or (randnbr==9) or (randnbr==10) or (randnbr==11) or (randnbr==12) or (randnbr==13)
...
Q5, relevance equation: (randnbr==4) or (randnbr==10) or (randnbr==15) or (randnbr==19) or (randnbr==23) or (randnbr==24) or (randnbr==25)
...
The follow-ups analogue.

Well, that will do it.
But, if you want to display randomly Q2->Q5 or Q5->Q2, I have no idea

Regards
Joffm
The following user(s) said Thank You: gsoto

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

More
5 months 4 weeks ago #161865 by tpartner
tpartner replied the topic: show n out of x questions and follow-up questions
If the questions are mandatory, you could...

1) Place each pair in a separate group.

2) Randomize the group order.

3) In group relevance, use the Expression Manager count() function to detect how many questions have already been answered.

So, for example, with 4 groups, the relevance for Group 1 is:
{count(Q2, Q3, Q4) < 2}

The relevance for Group 2 is:
{count(Q1, Q3, Q4) < 2}

The relevance for Group 3 is:
{count(Q1, Q2, Q4) < 2}

The relevance for Group 4 is:
{count(Q1, Q2, Q3) < 2}

Sample survey attached.

File Attachment:

File Name: limesurvey...5677.lss
File Size:17 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: gsoto

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

More
5 months 4 weeks ago #161871 by gsoto
gsoto replied the topic: show n out of x questions and follow-up questions
Thanks for both your replies.

@Joffm: I had used this method in an earlier survey. However, I would have done it with a random number (1-56), not realizing that half of them would be duplicates (e.g. 1-2 and 2-1, which results in the same if the order of the questions is fixed). I was hesitant to use this method again though, because it's quite time-consuming to implement, and I'm looking for an as-simple-as-possible way to do this in the future. The beauty of the solution using relevanceStatus (link in my first post) is that you can easily change your mind about the n (if you want to show 3 out of 8 instead of 2 out of 8, just change LT 2 to LT3 in the relevance equation of each question). For this particular situation with follow-up questions however, I'm probably better off using the method you suggested.

@tpartner: Unfortunately, the questions aren't mandatory, so your solution won't work. It's not possible to get the relevanceStatus of a question group, right? This would allow me to adapt the relevanceStatus method on a group level.

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

More
5 months 4 weeks ago #161882 by tpartner
tpartner replied the topic: show n out of x questions and follow-up questions
No, there is no variable for group relevance status.

A workaround would be to insert a hidden (via CSS class) question into every group with a default answer. Then you could count those questions.

Something like:

count(hidden2.NAOK, hidden3.NAOK, hidden4.NAOK) < 2

Sample survey attached:

File Attachment:

File Name: limesurvey...6771.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:

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

More
5 months 4 weeks ago #161898 by gsoto
gsoto replied the topic: show n out of x questions and follow-up questions
Following a suggestion by a co-worker, I now implemented a solution based on random numbers, but simpler than rand(1-28). The solution uses three numbers randomA, randomB and randomC.

randomA: rand(1-8)
randomB: rand(1-7)
randomC: if(randomA + randomB > 8, randomA + randomB - 8, randomA + randomB)

Then for each question 1…n, use the following relevance equation: randomA == n or randomC == n

This ensures that 2 out of 8 question are shown at random. The order of the questions is fixed though, as Joffm already noted. The advantage is that all the questions can be on one page. Tony's solution would ensure true randomness (including in the order) and easy adaptation to e.g. 3 out of 8 questions, but forces me to have the questions in different groups. It's a trade-off, both solutions work – so thanks again for the suggestion!

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!