Randomization "between respondents", but not within a questionnaire...

More
5 years 9 months ago #74756 by mguimezanes
mguimezanes created the topic: Randomization "between respondents", but not within a questionnaire...
Hi all!

I would like to know if it possible to randomize sub-questions, not within a questionnaire but between questionnaires adressed to different respondent.

Basically, I have 3 questions with the same subquestions (lines in an array) within a questionnaire. I want them in the same order for one respondent. But I don't want the next respondent to have the same order. I would like to neutralize the bias that might exist when you don't use randomized order, but at the same time, ensure that the questionnaire is still easy to use for each respondent. I hope this makes sense! ;)

Do you think this is possible? How can I do it?

Thank you!

Marie

Please Log in to join the conversation.

More
5 years 9 months ago #74796 by tpartner
tpartner replied the topic: Randomization "between respondents", but not within a questionnaire...
You can do this with JavaScript but the details of the script would depend on how the questions are displayed (it would be easiest if all displayed on the same page). Can you attach a sample survey?

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.

More
5 years 9 months ago #74928 by Mazi
Mazi replied the topic: Randomization "between respondents", but not within a questionnaire...
Tony, how would you do that by using JS? Read out the SAVEDID and use that as a basis for a certain randomization, so that the randomization is repeated every X users?


Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)survey-consulting.com'"

Please Log in to join the conversation.

More
5 years 9 months ago #74937 by tpartner
tpartner replied the topic: Randomization "between respondents", but not within a questionnaire...
I think that mguimezanes wants all 3 arrays to have randomized subquestion order but that all 3 use the same order for a given user.

I would give all identical subquestions the same codes or a common prefix. Then I could create a JavaScript array of all of the codes or prefixes, randomize that array and use it to display the subquestions for all 3 questions in the randomized order.

If the questions are on separate pages, a cookie could be used to store the randomized JavaScript array.

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.

More
5 years 9 months ago #75023 by mguimezanes
mguimezanes replied the topic: Randomization "between respondents", but not within a questionnaire...
Thanks for the inputs, but I think this is getting much too technical for my limited IT skills (I don't know avything about javascript)! I guess I'll just choose between not randomizing and randomizing everything!

Please Log in to join the conversation.

More
5 years 9 months ago #75052 by tpartner
tpartner replied the topic: Randomization "between respondents", but not within a questionnaire...
mguimezanes, if you can attach a sample survey I can give you an example of the script.

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.

More
5 years 9 months ago #75063 by DenisChenu
DenisChenu replied the topic: Randomization "between respondents", but not within a questionnaire...
Hello,

You can randomise the first array, get the order, ad use this order for the next question.

The difference it's : using PHP randomize and not javascript randomize :).

Denis

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 8 months ago #75115 by mguimezanes
mguimezanes replied the topic: Randomization "between respondents", but not within a questionnaire...
OK. Thanks guys! I am not sure what "format" you want it, I attach the quexml document, tell me if it suits you. The questions I want to randomize are in section C (these are the codes in the pdf file).

I want to randomize the subquestions in questions:
- C1 and C6 ("Paris Declaration" ... "Istanbul principles")
- C2, C3, C4, C5 ("Donors" ... "NGO network or think tank")

Do you think this is manageable?

Thanks for your help!

Marie

Please Log in to join the conversation.

More
5 years 8 months ago #75116 by mguimezanes
mguimezanes replied the topic: Randomization "between respondents", but not within a questionnaire...
Did the attachment work? Let's try again...
C:\fakepath\quexmlpdf_36525_en.zip

Please Log in to join the conversation.

More
5 years 8 months ago #75117 by mguimezanes
mguimezanes replied the topic: Randomization "between respondents", but not within a questionnaire...
OK... let's work step by step! How do you attach a file??

Please Log in to join the conversation.

More
5 years 8 months ago #75153 by DenisChenu
DenisChenu replied the topic: Randomization "between respondents", but not within a questionnaire...
I have allways difficulty to attach a file.

But here, we need lss file, not queXML . Maybe it work with lss ..

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
5 years 8 months ago #75170 by mguimezanes
mguimezanes replied the topic: Randomization "between respondents", but not within a questionnaire...
OK. Here is the lss file then (hopefully!).

File Attachment:

File Name: limesurvey...6525.lss
File Size:193 KB
Attachments:

Please Log in to join the conversation.

More
5 years 8 months ago #75171 by mguimezanes
mguimezanes replied the topic: Randomization "between respondents", but not within a questionnaire...
YAY! ;)

Please Log in to join the conversation.

More
5 years 8 months ago #75174 by tpartner
tpartner replied the topic: Randomization "between respondents", but not within a questionnaire...
Okay, I see that in the third group you have several array questions and several multiple-options questions. I assume you want all of the arrays randomized in the same order and all of the multiple-options randomized in the same order.

1) Set up your survey to use JavaScript .

2)Add the following script to the source of one of the questions.

The script sorts all of the array questions into the same random order and then does the same thing for all of the multiple-options questions.
<script type="text/javascript" charset="utf-8">
 
	$(document).ready(function() { 
 
		// Find the survey and group IDs
		if($( 'input#fieldnames' ).length != 0) {
			var fieldNames = $( 'input#fieldnames' ).attr('value');
			var tmp = fieldNames.split('X');
			var sID = tmp[0];
			var gID = tmp[1];
		}
 
		////// HANDLE THE ARRAY QUESTIONS //////
 
		// Build an array of the array sub-question codes
		var subquestions = new Array();
		var qID = $('.array-flexible-row:eq(0)').attr('id').split('question')[1];
		$('.array-flexible-row:eq(0) table.question tbody').each(function(i){
			var ansCode = $(this).attr('id').split('X'+qID+'')[1];
			subquestions.push(ansCode);
		});
 
		// Shuffle the sub-question codes
		shuffle(subquestions);
 
		// Loop through all array questions and randomize them in the same order
		$('.array-flexible-row').each(function(i){
			var qID2 = $(this).attr('id').split('question')[1];
			$(subquestions).each(function(i){
				$('#question'+qID2+' table.question').prepend($('#javatbd'+sID+'X'+gID+'X'+qID2+this));
			});
 
			// Fix up the row background colours
			var rowIndex = 0;
			$('#question'+qID2+' table.question tbody tr').each(function(i, el){
				rowIndex ++;
 
				$(el).removeClass('array1, array2');
 
				if(rowIndex % 2 == 0) {
					$(el).addClass('array1');
				}
				else {
					$(el).addClass('array2');
				}
			});
		});
 
		////// HANDLE THE MULTIPLE-OPTIONS QUESTIONS //////
 
		// Build an array of the multiple-options sub-question codes
		var subquestions2 = new Array();
		var qID3 = $('.multiple-opt-comments:eq(0)').attr('id').split('question')[1];
		$('.multiple-opt-comments:eq(0) li[id^="javatbd"]').each(function(i){
			var ansCode3 = $(this).attr('id').split('X'+qID3+'')[1];
			subquestions2.push(ansCode3);
		});
 
		// Shuffle the sub-question codes
		shuffle(subquestions2);
 
		// Loop through all multiple-options questions and randomize them in the same order
		$('.multiple-opt-comments').each(function(i){
			var qID4 = $(this).attr('id').split('question')[1];
			$(subquestions2).each(function(i){
				$('#question'+qID4+' li[id^="javatbd"]:eq(0)').parent().prepend($('#javatbd'+sID+'X'+gID+'X'+qID4+this));
			});
		});
 
		function shuffle(o){
			for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
			return o;
		}			
 
	});
 
</script>

Here is your sample survey back with the script in the source of the first question of group 3.

File Attachment:

File Name: limesurvey...5_TP.lss
File Size:199 KB

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:

Please Log in to join the conversation.

More
5 years 8 months ago #75386 by mguimezanes
mguimezanes replied the topic: Randomization "between respondents", but not within a questionnaire...
Thanks so much tpartner!

But I still have questions:
1- How do I "set up my survey to use JavaScript"?
2- What should I do for the other questions? Would copy-paste work??
3- What do I do with that file?

And just to be sure, this script will enable me to have the same orders for array/sub-questions in one given questionnaire, but different order for the next respondent, right?

I told you, my IT skills are very limited!

Thanks again!
Marie

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!