Randomize two sets of answer choices

More
3 months 3 weeks ago - 3 months 3 weeks ago #157549 by wendyt
wendyt created the topic: Randomize two sets of answer choices
Dear fellows,

I'm a new LimeSurvey user and would like to see if we can set the radio question with 2 sets of answers. I checked there are ways to completely randomize all choices or partially with fixed order. But I cannot find a way to manage in particular the below:

Set 1:
Strongly agree
Agree
Neutral
Disagree
Strongly disagree
Don't know

Set 2:
Strongly disagree
Disagree
Neutral
Agree
Strongly agree
Don't know

Thank you very much!
Last Edit: 3 months 3 weeks ago by wendyt.

Please Log in to join the conversation.

More
3 months 3 weeks ago - 3 months 3 weeks ago #157552 by Joffm
Joffm replied the topic: Randomize two sets of answer choices
Hi, wendyt,
maybe there is a way to do this with Javascript.
But here are two ways to do it just out of the box.

1. Create two questions (Q1A and Q1B) with answer options:
Q1A:
1 =Strongly agree
2 =Agree
3 =Neutral
4=Disagree
5=Strongly disagree
9=Don't know

Q1B:
5=Strongly disagree
4=Disagree
3=Neutral
2=Agree
1=Strongly agree
9=Don't know

Create a random number and display the questions according to that number. For analysis you get always the same codes.

2. Tayloring:
Create a random number. (rn)
create your answer options like:
1 = {if(rn==1,"Strongly agree","Strongly disagree")}
2 = {if(rn==1,"Agree","Disagree")}
...
9=Don't know

In this case you have only one question, but you have to recode the codes for analysis.
E.g. "if (rn=2) and (code<>9) then code=6-code"

You can do this either in your analysis software, EXCEL, OpenOffice, SPSS, or whatever.
But you can do it in LS by Expression Manager, too.

sample attached


Best regards
Joffm
Attachments:
Last Edit: 3 months 3 weeks ago by Joffm.
The following user(s) said Thank You: wendyt

Please Log in to join the conversation.

More
3 months 3 weeks ago #157564 by wendyt
wendyt replied the topic: Randomize two sets of answer choices
Thank you very much Joffm. The first way is easy to manage ;)
Cheers!

Please Log in to join the conversation.

More
3 months 3 weeks ago #157566 by tpartner
tpartner replied the topic: Randomize two sets of answer choices
Here is a JavaScript solution to randomly invert all except the last answer within a single question.

Set up your survey to use JavaScript and place the following script in the source of the question:

<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){	
 
		// Identify this question
		var qID = {QID};
		var thisQuestion = $('#question'+qID);
 
		// Generate random number between 1 & 2
		var rand = Math.floor(Math.random() * 2) + 1
 
		// If the random number = 2...
		if(rand == 2) {
			// Reverse the answer order (excepting the last answer)
			var lastAnswer = $('.answer-item:last', thisQuestion);
			var tr = $('.answer-item', thisQuestion).not(lastAnswer).detach().toArray();
			tr.reverse();
			$.each(tr, function(i, el) {
				$('.answers-list', thisQuestion).append(el);
			});
			$('.answers-list', thisQuestion).append(lastAnswer);
		}
	});	
</script>

Sample survey attached:

File Attachment:

File Name: limesurvey...8-14.lss
File Size:15 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: wendyt

Please Log in to join the conversation.

More
3 months 3 weeks ago #157717 by wendyt
wendyt replied the topic: Randomize two sets of answer choices
Thanks so much! i'm new to JavaScript solution but would definitely try this out.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!