Welcome to the LimeSurvey Community Forum

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

Randomisation of groups and question blocks (subgroups) within groups

More
2 months 4 weeks ago #266765 by fesoj
Please help us help you and fill where relevant:
LimeSurvey version: 6.6.3
Own server or LimeSurvey Cloud: Cloud
Survey theme/template:
==================
Hi all,

I am struggling to realise the following in LimeSurvey:
1. Randomise the order of two question groups A and B
2. Randomise the order of "question blocks" within group B

Setup (simplified)

Group A:
A1
A2


Group B:
B1a
B1b
B2a
B2b

B1a needs to be followed by B1b
B2a needs to be followed by B2b

Obviously, I can randomise group A and B through the normal group randomisation feature.
I could also put B1a and B1b into one group, and B2a and B2b in the other, but then they won't be randomised together as a group vs Group A anymore. In other words, I would also get orders like B1 > A > B2, which I do not want. I only want four possible outcomes:
A > B1 > B2
A > B2 > B1
B1 > B2 > A
B2 > B1 > A 

Subgroups for B would be useful here, but I could not find them.

Hope you can help!

Best,
fesoj

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 3 weeks ago #266768 by Joffm
Hi,
there is no "group in group" concept. So there are no logical "subgroups".
I am sure the next user will require "sub-subgroups".

What I'd do is:
  • Double the question B1a and B1b.
  • Create a random number (1-2) (randnbr)
  • Order the questions in group B without any randomization group name, but with the following conditions
    B1a1: randnbr==1
    B1b1: randnbr==1
    B2a
    B2b
    B1a2: randnbr==2
    B1b2: randnbr==2

That's the easiest way in my opinion.,

To display the two groups and the questions in  group A in randomized you use the randomization groups, as you already did.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
2 months 3 weeks ago #266808 by fesoj
Hi Joffm,

thanks a lot for the swift reply and solution. This workaround does the trick! Although of course every duplication of questions, especially if B1 questions are many, makes things more complicated to maintain (always in double) and affects things like the progress bar which cannot take into account relevance in calculating total question numbers. But for my specific survey case, the amount of duplicated questions is manageable.

On a side note for others with this question, I had problems with the randomise function rand() initially. Upon searching the forum, I learned the function can get called multiple times, which meant the relevance logic wasn't working reliably:
forums.limesurvey.org/forum/design-issue...ng-survey-using-rand
So I used this formula provided by TMSWhite, which works and ensures the randomisation only happens once:
Code:
{if(randomisequestion>0,randomisequestion, rand(1,2))}

Best
fesoj

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 months 3 weeks ago - 2 months 3 weeks ago #266809 by Joffm
Hi,

especially if B1 questions are many

Your requirement was:
Group B:
B1a
B1b
B2a
B2b
Two questions, not "many". You get what you ask for.

If there are really many questions you have to redesign your survey.
You may use subsurveys, a father-son approach, maybe you can use "tayloring".
What is the best, depends on the specific survey

And by the way:
Nearly each post in the forum referring to random numbers mentions this better approach. to avoid the Excel like behaviour of the "rand()" function.

And to add:
{if(randomisequestion>0,randomisequestion,rand(x,y))}
may fail.
E.g. if you want to create a random number between 0 and 100, or between -5 and +5.
So better
{if(is_empty(self.NAOK),rand(x,y),self.NAOK)}
As you find in the manual
[url] www.limesurvey.org/manual/ExpressionScri...%22that%22_variables [/url]
the variable "self" refers to the same question, while "that" refers to other questions.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 2 months 3 weeks ago by Joffm.

Please Log in to join the conversation.

More
2 months 3 weeks ago - 2 months 3 weeks ago #266810 by fesoj
Hi Joffm,

I did add the "(simplified)" to the example, to give just a minimum complexity setup reduced to the problem. Thought that was helpful without cluttering the request with additional info. But could and maybe should have specified it's more than 2 questions    Here to learn!

Thanks also for the more bulletproof tip on randomisation.

fesoj
Last edit: 2 months 3 weeks ago by fesoj.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose