Choice Experiment/Conjoint Analysis

More
1 month 3 weeks ago #203605 by liamcal
Hello,

I am a university student partaking in my honours year. I am exploring how various attributes of Corporate Social Responsibility impact on consumer behaviour.

I am trying to create a Choice Experiment that looks like this the first attachment, but the closest thing I've been able to do is just upload the image into the question and simply provide the three options via a drop down menu.

I want to be able to just incorporate the table, attributes, levels, and answer to be selected all into one table as the question (refer to attached file).. I know it requires some kind of HTML coding but I can't seem to even find where this HTML editor is located. This is my first survey ever done using lime survey

If anyone could provide some help or guidance that would be greatly appreciated. Thank you in advance for any assistance provided!!

Liam
Attachments:

Please Log in to join the conversation.

LimeSurvey Partners
More
1 month 3 weeks ago #203609 by Joffm


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

Please Log in to join the conversation.

More
1 month 3 weeks ago - 1 month 3 weeks ago #203658 by liamcal
Hi Joffm,

Thank you so much for your response.

I can now see how entering code into the question field can create a Choice Experiment, unfortunately however, I can not seem to import lss files as I can not find a location to import it on Lime Survey. The manual states importing a survey can be done under the surveys tab but all that comes up for me is 'list surveys'.

Am I looking in the wrong place for this?

Thanks again for any assistance.

Liam
Last edit: 1 month 3 weeks ago by liamcal.

Please Log in to join the conversation.

More
1 month 3 weeks ago - 1 month 3 weeks ago #203661 by Joffm
As a student you probably are using a university installation of LS.
If you do not see this

you obviously have no rights to do it.


But here is the code.
Create a question of type "array" and enter there two snippets in question text (source code mode)
First the HTML table to display the question
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse:collapse;color:blue">
	<tbody>
		<tr>
			<td style="text-align: left;" width="0%">Which ONE of the following is the BEST OPTION for you? </td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#D4D7E4" style="text-align: center;" width="15%"><br /><span style="font-size:12px;"><strong>Scenario 1</strong></span><br /> </td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#D4D7E4" style="text-align: center;" width="15%"><span style="font-size:12px;"><strong>Scenario 2</strong></span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#D4D7E4" style="text-align: center;" width="15%"><span style="font-size:12px;"><strong>Scenario 3</strong></span></td>
		</tr>
		<tr style="height: 6px; text-align: center;">
		</tr>
		<tr>
			<td bgcolor="#f2f2f2" style="text-align: left;"><span style="font-size:12px;">Range of services</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;">
			<div><span style="font-size:12px;">Full range</span></div>
			</td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Broader but not comprehensive</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Limited range of services</span></td>
		</tr>
		<tr style="height: 6px; text-align: center;">
		</tr>
		<tr>
			<td bgcolor="#f2f2f2" style="text-align: left;"><span style="font-size:12px;">Time willing to wait for medication after general consultation</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Medication to be given immediately</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Collect after one day</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Collect after a week</span></td>
		</tr>
		<tr style="height: 6px; text-align: center;">
		</tr>
		<tr>
			<td bgcolor="#f2f2f2" style="text-align: left;"><span style="font-size:12px;">Subquestion 3</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 1</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 2</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 3</span></td>
		</tr>
		<tr style="height: 6px; text-align: center;">
		</tr>
		<tr>
			<td bgcolor="#f2f2f2" style="text-align: left;"><span style="font-size:12px;">Subquestion 4</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 1</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 2</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 3</span></td>
		</tr>
		<tr style="height: 6px; text-align: center;">
		</tr>
		<tr>
			<td bgcolor="#f2f2f2" style="text-align: left;"><span style="font-size:12px;">Subquestion 5</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 1</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 2</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 3</span></td>
		</tr>
		<tr style="height: 6px; text-align: center;">
		</tr>
		<tr>
			<td bgcolor="#f2f2f2" style="text-align: left;"><span style="font-size:12px;">Subquestion 6</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 1</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 2</span></td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:12px;">Option 3</span></td>
		</tr>
		<tr style="height: 6px; text-align: center;">
		</tr>
		<tr>
			<td bgcolor="#f2f2f2" style="text-align: left;font-size:12px;font-weight:bold">Your choice </td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"> </td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2" style="text-align: center;"> </td>
			<td style="text-align: center;" width="0%"> </td>
			<td bgcolor="#f2f2f2"> </td>
		</tr>
	</tbody>
</table>

And here the javascript part.
<script type="text/javascript" charset="utf-8">
 
 
	$(document).on('ready pjax:scriptcomplete',function(){
 
		// Identify this question
		var thisQuestion = $('#question{QID}');
 
		// Move the radios
		$('.question-text table:eq(0) tr:last td:eq(2)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(0) *', thisQuestion));
		$('.question-text table:eq(0) tr:last td:eq(4)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(1) *', thisQuestion));
		$('.question-text table:eq(0) tr:last td:eq(6)', thisQuestion).append($('.subquestion-list .answers-list:eq(0) .answer-item:eq(2) *', thisQuestion));
 
		// Some classes for presentation
		$('.question-text table:eq(0) input:radio', thisQuestion).closest('td').addClass('answer-item radio-item text-center radio');
		$('.question-text table:eq(0) .radio-item label', thisQuestion).show();
 
		// Click event on the table cells
		$('.question-text table:eq(0) .radio-item', thisQuestion).on('click', function(e) {
			$('input:radio', this).trigger('click');
		});
		$('.question-text table:eq(0) input:radio', thisQuestion).on('click', function(e) {
			e.stopPropagation();
		});
 
		// Clean-up styles
		$('.answer-container', thisQuestion).hide();
		$('.question-text table:eq(0) .label-text', thisQuestion).remove();
		$('.question-text table:eq(0) .radio-text', thisQuestion).css({
			'cursor': 'pointer'
		});
    });
</script>

Joffm


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

Please Log in to join the conversation.

More
1 month 3 weeks ago #203720 by liamcal
Hi Joffm,

Thanks again for your help.

Yes I think you are right about having the university version, I can not see the drop down list that you see.

I copy and pasted the two snippets in the question text and this is looking awesome!

One issue however (see attached) when I preview the question the answer buttons are appearing outside of the Choice Experiment table, and only two answer buttons are appearing.

Is there any way to rectify this issue?

Thanks again Joffm!!

Liam
Attachments:

Please Log in to join the conversation.

More
1 month 3 weeks ago - 1 month 3 weeks ago #203721 by liamcal
UPDATE:

I was not entering the text you provided me with in Source code mode.

I have now done that and am attaching an updated image that is done with the text entered in source code mode.

Still the same problem but it is looking tidier.
Attachments:
Last edit: 1 month 3 weeks ago by liamcal.

Please Log in to join the conversation.

More
1 month 3 weeks ago #203726 by Joffm
Obviously you are doing something wrong.
What type of question do you use?
Which answer options did you enter?

So you should show us your survey.
Send a lss export.

Joffm


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

Please Log in to join the conversation.

More
1 month 3 weeks ago #203732 by liamcal
Hi Joffm,

I am using the 'Array' question type.

I have left the subquestions blank and for answer options I have inserted two, A and B.

To be honest, regarding answer options, I am not sure what answer options are needed to make this work? Any advice regarding answer options would be greatly appreciated.

Thanks again Joffm, you have been a big help :) I believe I have attatched the lss export of my survey.

Here is also an image of what I have so far regarding the question (question code is Q03)


File Attachment:

File Name: limesurvey...7519.lss
File Size:40 KB



Liam
Attachments:

Please Log in to join the conversation.

More
1 month 3 weeks ago #203735 by Joffm
Hi,
are you sure you attached the correct lss export.
This one does not match your image.

You should better use three answer options without the default "No answer".

And as you seem to be very restricted, are you allowed to insert javascript?
XSS filter in "Configuration / Global Settings / Security"

Joffm


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

Please Log in to join the conversation.

More
1 month 3 weeks ago #203740 by liamcal
Apologies Joffm, I think I was careless and attached the incorrect lss export.

I believe the one attached to this post will be the correct ton that corresponds to the above image.

In regards to my ability to use javascript, I am not sure. I can not locate "Configuration / Global Settings / Security" unfortunately.

File Attachment:

File Name: limesurvey...19-3.lss
File Size:234 KB


Liam
Attachments:

Please Log in to join the conversation.

More
1 month 3 weeks ago - 1 month 3 weeks ago #203745 by tpartner

liamcal wrote: In regards to my ability to use javascript, I am not sure. I can not locate "Configuration / Global Settings / Security" unfortunately.

Does your JavaScript get removed when you safe the question?

Try a simple alert in the question source:

<script type="text/javascript" charset="utf-8">	
 
	$(document).on('ready',function(){
 
		alert('JavaScript works!');
    });
</script>

- manual.limesurvey.org/Workarounds:_Manip...tc..29_in_LimeSurvey

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 1 month 3 weeks ago by tpartner.

Please Log in to join the conversation.

More
1 month 3 weeks ago - 1 month 3 weeks ago #203746 by Joffm
This is what I see simply importing your file.


If it looks like this or similar, you are not allowed to include javascript.


So you have to think of a different solution, e.g. placing separate tables as subquestion and answer options.

Joffm


By the way:
You should revise some questions.
Q16. Single choice with "Other"-Option

Q18. Multiple with comment (only one answer possible)


And do you really think somebody will answer Q20?


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

Please Log in to join the conversation.

More
1 month 3 weeks ago #203779 by liamcal
Hi tpartner,

I entered the alert you provided into the question source.

Now, when I preview the survey question, I am alerted with the following image:





I guess this means Javascript works then and I am doing something wrong?

Liam
Attachments:

Please Log in to join the conversation.

More
1 month 3 weeks ago #203780 by liamcal
Hi joffm,

The first image is what I am aiming for, but unfortunately I get the second image.

Perhaps I am entering the Javascript incorrectly?

I have been firstly, reopening the question, then clicking on the 'Source' icon. Then I copy and paste the html table you sent me. Then on the line underneath it, I copy and paste the Javascript part.

I am going to speak with my university to see if I can get full access rights to LS, I think this will solve my problems.

In regards to your suggestions, firstly, thank you for your suggestion regarding Q16. That definitely is a better, more intuitive solution.

In regards to Q18, although I had not fully completed the question yet, I think your solution is better to what I had planned for it. Because my survey will be international, I wasn't too sure how to ask for household income, because everyone's currency will be different. Personally, I think asking them to choose their currency, and then asking to provide household income to the nearest 5000 in their respective currency (in the text space next to the currency in your image) is the best way to approach the question, so thank you.

In regards to Q20, I am interested to hear more feedback from you. Do you think asking the question itself is insensitive, or do you think the way in which the question is being asked is poor (too many options). Feel free to let me know as I would love to hear your thoughts.

Thanks again joffm,

Liam

Please Log in to join the conversation.

More
1 month 3 weeks ago #203782 by Joffm

Perhaps I am entering the Javascript incorrectly?

Obviously not.
I wrote that I imported your lss export and got the correct display.

Here this survey back.

File Attachment:

File Name: limesurvey...1919.lss
File Size:235 KB

I only changed the column width a bit and centered.
Your columns did not sum up to 100%,
It's not necessary, but better.
But you may find some settings the satisfy your wishes.


Q18.
If there will be more currencies, use two questions.
Numeric field for amount, drop-down with the currency list.
Or an array with two columns and drop-down display.
I will send an example later.
Will be another try of the javascript ability.


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

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now