Welcome to the LimeSurvey Community Forum

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

Choice Experiment/Conjoint Analysis

  • liamcal
  • liamcal's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 3 months ago #203605 by liamcal
Choice Experiment/Conjoint Analysis was created 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
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 3 months ago #203609 by Joffm
Replied by Joffm on topic Choice Experiment/Conjoint Analysis
Hi, liamcal,

here you find some threads about it with attached sample surveys.
forums.limesurvey.org/forum/can-i-do-thi...dels?start=15#170368

forums.limesurvey.org/forum/can-i-do-thi...ions-in-a-box#184037

forums.limesurvey.org/forum/german-forum...ce-experiment#186322
This last thread is in German (but there is google translate)

And here a sample

File Attachment:

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


Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • liamcal
  • liamcal's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 2 months ago - 4 years 2 months ago #203658 by liamcal
Replied by liamcal on topic Choice Experiment/Conjoint Analysis
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: 4 years 2 months ago by liamcal.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago - 4 years 2 months ago #203661 by Joffm
Replied by Joffm on topic Choice Experiment/Conjoint Analysis
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
Code:
<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.
Code:
<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
Last edit: 4 years 2 months ago by Joffm.
The topic has been locked.
  • liamcal
  • liamcal's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 2 months ago #203720 by liamcal
Replied by liamcal on topic Choice Experiment/Conjoint Analysis
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
The topic has been locked.
  • liamcal
  • liamcal's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 2 months ago - 4 years 2 months ago #203721 by liamcal
Replied by liamcal on topic Choice Experiment/Conjoint Analysis
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.
Last edit: 4 years 2 months ago by liamcal.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #203726 by Joffm
Replied by Joffm on topic Choice Experiment/Conjoint Analysis
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
The topic has been locked.
  • liamcal
  • liamcal's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 2 months ago #203732 by liamcal
Replied by liamcal on topic Choice Experiment/Conjoint Analysis
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
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago #203735 by Joffm
Replied by Joffm on topic Choice Experiment/Conjoint Analysis
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
The topic has been locked.
  • liamcal
  • liamcal's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
4 years 2 months ago #203740 by liamcal
Replied by liamcal on topic Choice Experiment/Conjoint Analysis
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
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago - 4 years 2 months ago #203745 by tpartner
Replied by tpartner on topic Choice Experiment/Conjoint Analysis

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:

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

- www.limesurvey.org/manual/Workarounds:_M...tc..29_in_LimeSurvey

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 4 years 2 months ago by tpartner.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 2 months ago - 4 years 2 months ago #203746 by Joffm
Replied by Joffm on topic Choice Experiment/Conjoint Analysis
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
Last edit: 4 years 2 months ago by Joffm.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose