Welcome to the LimeSurvey Community Forum

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

Controlling Randomization and Group Order

  • christofschulz97
  • christofschulz97's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #258152 by christofschulz97
Controlling Randomization and Group Order was created by christofschulz97
Version 5.6.31

Hi Dear LimeSurvey community,

I have a question about the setup of my survey. We are designing an experimental study in LimeSurvey and we need a specific type of randomization/order of our question groups. We have a number of images and questions that we are aiming to show to the participants. It is important that each group of images/questions is shown in a random order. However, after a random group was shown, a specific group of questions should be shown afterwards. Then, the next group is random again. 

So, the order should be:

Demographics
Random group->Specific group
Random group->Specific group
Random group->Specific group
End of Survey Questionnaire

To randomize the random groups, I put them in the same randomization group. For the specific groups I used the following relevance equation to show them only after the matching random group was shown:  G1Q1.NAOK  == "A11" OR  G1Q1.NAOK  == "A12"
This code refers to the first question in the random group and only allows the specific group to be shown, if the first item in the group was answered.

So far it works that the specific group is shown only if the random group has been answered, but my problem is that the order is messed up. The specific group needs to be shown with its matching random group right afterwards. With my code, the specific group is shown somewhere in the survey after the random group, but not right after it. 

Another specification of our experimental design is that the participants are not allowed to see the image in the specific group before they responded to the random group, because that might influence their decision and we want to avoid that. Therefore, I cannot put all the items in the same group and use simple conditions, because if I do that the new items are shown to the participants right after they select a response without proceeding to the next page. 

I am not sure if there is a way to solve this problem in LimeSurvey. Maybe you can help me! Please let me know if you need more information.

Thanks,

Chris

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258153 by Joffm
Replied by Joffm on topic Controlling Randomization and Group Order
You want to randomize three groups, but each contains two other groups.

This is not possible.
LimeSurvey does not support "group in group".

There may be other solutions to achieve your goal.
So, the best you provide a lss export of your survey.

Joffm

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

Please Log in to join the conversation.

  • christofschulz97
  • christofschulz97's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #258155 by christofschulz97
Replied by christofschulz97 on topic Controlling Randomization and Group Order
Hi Joffm,

Thank you for your quick reply. 

I made an .lss suitable for export. The group named with -1 at the end should be the randomized, the groups with -2 at the end should be following the randomized group.

So the order should be: 

1-1 -> 1-2
2-1 -> 2-2
3-1 ->3-2
{...}
14-1 ->14-2

If there is some workaround that does not require group-in-group functions that would be great! Just note that the elements of the second group are not allowed to be shown before the participants finalized the response to the first group. 

 

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258160 by tpartner
Replied by tpartner on topic Controlling Randomization and Group Order
Off the top of my head (responding from phone) a JavaScript/CSS solution...

Assuming the "specific" questions are tied to the "random" questions:

- Place the "specific" questions in the same groups as their "random" questions

- Hide the "specific" questions

- After completing the "random" questions, the "Next" button funtionality is interrupted, the "random" questions are hidden and the "specific" questions are shown.

One drawback would be how to handle returning to the page.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258163 by Joffm
Replied by Joffm on topic Controlling Randomization and Group Order
I see that all groups are equal except the image
An easy solution to run the survey is:
Create a random string; you will get something like
'BDKNAJFCGMIEHL'
Do not randomize the groups at all
Rename your images.
imageA.jpg, imageB.jpg,...
Display the images according to your random string
<img src=.../image{substr(QRand,0,1)}.jpg...
<img src=.../image{substr(QRand,1,1)}.jpg...
...

Advantage: Really easy to implement
Disadvantage: You have to restructure your data before analyzing them.

Joffm

One strange thing:
In none of my browsers a can use the editor of the forum, only this "Quick reply"

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

Please Log in to join the conversation.

  • christofschulz97
  • christofschulz97's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago #258164 by christofschulz97
Replied by christofschulz97 on topic Controlling Randomization and Group Order
Hi tpartner,

thanks for the idea! It is actually desired that participants cannot return to the previous page, because the elements of the second group show answers to the first random group which participants are not supposed to be influenced by when responding to the first group.

I understand the first two steps of your solution: Placing the questions in the same group and then using "always hide this question" for the specific questions. But how do I then create a function that shows the elements of the second group after the participants click on "next"? Do I need to write a custom script for this? I need a bit of context to understand the last step of your solution, sorry... :)

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258167 by tpartner
Replied by tpartner on topic Controlling Randomization and Group Order
Yes, as indicated you will need JavaScript but I'm away from a computer so cannot provide an example at the moment.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • christofschulz97
  • christofschulz97's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 2 weeks ago - 1 month 2 weeks ago #258168 by christofschulz97
Replied by christofschulz97 on topic Controlling Randomization and Group Order
Hi Joffm,

For me the forum editor works, but I have to click on "quick reply" and then on "go to editor" afterwards.

I think I need to give a bit more context on the study setup, sorry. The images are actually the same in the random and the specific group. The only difference is that in the specific group the participants will receive additional context to the images, in our case it is AI-voorspelling: maligne or AI-voorspelling benigne. Then with the additional information in the specific group the participants have to give a new diagnosis for the image.

We need to control which image is shown together with which text. So we can't assign random images to each group, because the text element in the specific group needs to match with the image. Maybe there is another clever way to match the image with the text and then to randomize both elements together? 

 
Last edit: 1 month 2 weeks ago by christofschulz97.

Please Log in to join the conversation.

More
1 month 2 weeks ago #258170 by jelo

One strange thing:
In none of my browsers a can use the editor of the forum, only this "Quick reply"
That seems to be limited to the Firefox browser. Still not sure what the root issue is, but I have experienced the same issues when visiting the forum with a Firefox browser.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago - 1 month 2 weeks ago #258171 by Joffm
Replied by Joffm on topic Controlling Randomization and Group Order
Well, the matching text is not a problem.
You have the random order.
So you display the text.

Here a small sample survey; only 4x2 groups
 

Attachment not found


In "QRand" the question to get the random order, I used numbers (because of the name of my images)
You should use letters; you have more then 10 groups.

At the end I display some information about the order.

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 1 month 2 weeks ago by Joffm.
The following user(s) said Thank You: tpartner, christofschulz97

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 month 2 weeks ago #258174 by tpartner
Replied by tpartner on topic Controlling Randomization and Group Order
My solution:

1) Place the "specific" questions in the same groups as their "random" questions.

2) Assign the "random" questions a CSS class "sub-group-1".

2) Assign the "specific" questions a CSS class "sub-group-2".

4) Place this script in the source of the first question in the group. (I have also disabled the "Next" button until all questions within a sub-group are answered)

Code:
<script type="text/javascript" data-author="Tony Partner">
 
    $(document).on('ready pjax:scriptcomplete',function(){
 
        // Initially hide sub-group-2
        $('.sub-group-2').hide();
 
        // Initially disable the "Next" button
        $('#ls-button-submit').prop('disabled', true);
 
        // Listener on the radios
        $('.radio-list :radio').on('click', function(e) {
            console.log($('.radio-list:visible').length+' == '+$(':radio:visible:checked').length);
            if($('.radio-list:visible').length == $(':radio:visible:checked').length) {
                $('#ls-button-submit').prop('disabled', false);
            }
        });
 
        // Listener on the "Next" button
        $('#ls-button-submit').on('click', function(e) {
            if($('.sub-group-1:visible').length > 0) {
                e.preventDefault();
                $('.sub-group-1').hide();
                $('.sub-group-2').show();
                $('#ls-button-submit').prop('disabled', true);
            }
        }); 
    });
</script>

Sample survey attached:  

File Attachment:

File Name: limesurvey...7771.lss
File Size:106 KB

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: christofschulz97

Please Log in to join the conversation.

  • christofschulz97
  • christofschulz97's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 month 1 week ago #258639 by christofschulz97
Replied by christofschulz97 on topic Controlling Randomization and Group Order
Hi tpartner and joffm,

Sorry for not getting back to you, there were some issues with our local LimeSurvey environment. I finally got to test both of your solutions, and they work either way! Thank you so much!

Have a great weekend.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose