- Posts: 8
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
2 randomization groups for one question ?
- Hollowqueen8
- Topic Author
- Offline
- New Member
Less
More
3 years 1 week ago - 3 years 1 week ago #214516
by Hollowqueen8
2 randomization groups for one question ? was created by Hollowqueen8
Hello everyone!
In my survey, I want to present randomly 3 questions out of 8. I was able to do this. Except there are 4 types of questions for which I have done it, and ideally, I would want for the 3 * 4 = 12 questions to also be presented randomly (for know I have the 4 question groups one after the other, with the 3 randomly selected question, then the next 3, etc)
My issue is that I don't know if I can put more than one randomization group for one question. We can't type another line and I don't know which separator to use (e.g. : ; - / but none of those seem to work).
Any help would be greatly appreciated!
King Regards,
In my survey, I want to present randomly 3 questions out of 8. I was able to do this. Except there are 4 types of questions for which I have done it, and ideally, I would want for the 3 * 4 = 12 questions to also be presented randomly (for know I have the 4 question groups one after the other, with the 3 randomly selected question, then the next 3, etc)
My issue is that I don't know if I can put more than one randomization group for one question. We can't type another line and I don't know which separator to use (e.g. : ; - / but none of those seem to work).
Any help would be greatly appreciated!
King Regards,
Last edit: 3 years 1 week ago by Hollowqueen8. Reason: tried the different separators
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
3 years 1 week ago #214520
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic 2 randomization groups for one question ?
Hi,
I suppose by using two groups (one visible with three questions, one hidden with five questions, and the same randomization group name for all questions).
Well, here you set the randomization group name on question level.
To randomize your four groups set also the same randomization group name on group level (of course a different one).
Joffm
How did you do it?I was able to do this
I suppose by using two groups (one visible with three questions, one hidden with five questions, and the same randomization group name for all questions).
Well, here you set the randomization group name on question level.
To randomize your four groups set also the same randomization group name on group level (of course a different one).
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Hollowqueen8
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
3 years 1 week ago #214521
by Hollowqueen8
Replied by Hollowqueen8 on topic 2 randomization groups for one question ?
Thank you for your reply !
Yeah I did exactly as you suspected !
I don't think your solution would help because I would like for example the 2nd question of the first group, then the 3rd of the second one, 1st of the fourth group, 2nd of the fourth group, 1st of the third group etc, I would like for the 12 showed questions to not be all of one group then all of the next etc.
I may have found an answer without using the randomisation groups
Here : survey-consulting.com/how-to-randomize-i..._used_for_AB_testing
in the " Randomly show 1 of X follow up surveys "
--> could this be applied to my issue ? For example, I would roll some dices to get a pseudo random distribution of my 12 questions and then create 20 distributions so that I can set that I want this question first, and then this one etc ? Can I choose to show a set of questions instead of only one after the if ?
Also, I'm not sure if that would work because I can't know in advance which questions will get picked to be showed...so I would need to make the randomisation by hand for this too ? that seems a bit too "manipulated" and not enough randomised...
Yeah I did exactly as you suspected !
I don't think your solution would help because I would like for example the 2nd question of the first group, then the 3rd of the second one, 1st of the fourth group, 2nd of the fourth group, 1st of the third group etc, I would like for the 12 showed questions to not be all of one group then all of the next etc.
I may have found an answer without using the randomisation groups
Here : survey-consulting.com/how-to-randomize-i..._used_for_AB_testing
in the " Randomly show 1 of X follow up surveys "
--> could this be applied to my issue ? For example, I would roll some dices to get a pseudo random distribution of my 12 questions and then create 20 distributions so that I can set that I want this question first, and then this one etc ? Can I choose to show a set of questions instead of only one after the if ?
Also, I'm not sure if that would work because I can't know in advance which questions will get picked to be showed...so I would need to make the randomisation by hand for this too ? that seems a bit too "manipulated" and not enough randomised...
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
3 years 1 week ago #214524
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic 2 randomization groups for one question ?
Then you may use a different approach to select 3 out of 8: by javascript
Then you get 12 questions which you may randomize with one randomization group name.
Joffm
Then you get 12 questions which you may randomize with one randomization group name.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
3 years 1 week ago #214530
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic 2 randomization groups for one question ?
Here an example with some javascript.
Included are two different ways to select 3 out of 8.
The first (with the four multiple questions)
All these questions have 8 subquesions and 3 are randomly checked.
So the relevance equation of your questions are like M1_SQ001=="Y"
The second option with an question of type "short text"
Four arrays are shuffled and then the first three elements are extracted and joined to the result string.
In this case the relevance equation looks like
strpos(Sel,"31")>0
ALL 48 questions get the same randomization group name.
Joffm
Included are two different ways to select 3 out of 8.
The first (with the four multiple questions)
Code:
<script type="text/javascript" charset="utf-8"> var numberToShow = 3; $(document).on('ready', function(){ if($('#question{QID} input:checkbox:checked').length == 0) { $('#question{QID} input:checkbox:lt('+numberToShow+')').each(function(i) { $(this).nextAll('input:hidden').val('Y'); $(this).prop('checked', true).trigger('change'); }); } }); </script>
So the relevance equation of your questions are like M1_SQ001=="Y"
The second option with an question of type "short text"
Code:
<script type="text/javascript" charset="utf-8"> function shuffle(array) { var currentIndex = array.length, temporaryValue, randomIndex; // While there remain elements to shuffle... while (0 !== currentIndex) { // Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; // And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; } return array; } $(document).on('ready pjax:scriptcomplete',function(){ // Fill the arrays var arr1 = [11,12,13,14,15,16,17,18]; var arr2 = [21,22,23,24,25,26,27,28]; var arr3 = [31,32,33,34,35,36,37,38]; var arr4 = [41,42,43,44,45,46,47,48]; arr1 = shuffle(arr1); arr2 = shuffle(arr2); arr3 = shuffle(arr3); arr4 = shuffle(arr4); arr1 = arr1.slice(0,3).join(','); arr2 = arr2.slice(0,3).join(','); arr3 = arr3.slice(0,3).join(','); arr4 = arr4.slice(0,3).join(','); $('#question{QID} input[type="text"]').val("#,"+arr1+","+arr2+","+arr3+","+arr4); $('#question{QID}').hide(); }); </script>
Four arrays are shuffled and then the first three elements are extracted and joined to the result string.
In this case the relevance equation looks like
strpos(Sel,"31")>0
ALL 48 questions get the same randomization group name.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Hollowqueen8
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
3 years 1 week ago #214685
by Hollowqueen8
Replied by Hollowqueen8 on topic 2 randomization groups for one question ?
Thank you so much for your answer! Sadly I don't know any Javascript so it's a bit hard to understand but I'll figure it out!
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
3 years 1 week ago #214690
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic 2 randomization groups for one question ?
You got two solutions.
See the example.
Both JavaScript snippets can be used without modification.
So no need to know all details.
But remember to add them in source code mode.
Joffm
If there are more questions don't hesitate to ask, but always attach the lss export of your tries.
See the example.
Both JavaScript snippets can be used without modification.
So no need to know all details.
But remember to add them in source code mode.
Joffm
If there are more questions don't hesitate to ask, but always attach the lss export of your tries.
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.