Difficulties creating a conjoint question in Qualtrics | XM Community
Question

Difficulties creating a conjoint question in Qualtrics

  • 22 January 2021
  • 1 reply
  • 19 views

Hello,
I have been trying to create a conjoint question in Qualtrics using this document here as a guide: http://www.weebly.com/uploads/1/2/0/9/12094568/conjoint.pdf
Any advice would be greatly appreciated! I have the following HTML Code which has successfully made a table without any labels (other than Policy 1 and Policy 2 across the top):
Scenario 1 out of 5
 


 
 
 
 
 
 
 
  
  
  
  

 
 
  
  
  
 
 
  
  
  
 
 
  
  
  
 
 
  
  
  
 
 
  
  
  
 
 
 Policy 1Policy 2
   
   
   
   
   

 


And the following Javascript in the "Add Javascript" section:
Qualtrics.SurveyEngine.addOnReady(function()
{

// Start of Javascript

// Define the Dimensions
var attRaw = ["Method of Policy Implementation", "Level of Government Responsible", "Governing Party Responsible", "Method of Funding", "Monetary Equivalent of the Transfer"];
var att = ["Method of Policy Implementation", "Level of Government Responsible", "Governing Party Responsible", "Method of Funding", "Monetary Equivalent of the Transfer"];
var attributes = ["","","","",""];

//Randomize The Order of Dimensions (avoid recency and primacy)
for (i=0; ivar rand1 = Math.floor(Math.random()*((attRaw.length-i)-0));
attributes [i] = att[rand1];
att.splice(rand1,1);}

//Create Variables for Traits associated with each dimension
var method_raw = ["Mailed as a Check", "Issued as a Rebate on your Taxes", "Issued as a an Essential Product Voucher (e.g., food)"];
var gov_raw = ["Federal", "State", "Local"];
var party_raw = ["Democrat", "Republican"];
var funding_raw = ["Additional Income Taxes", "Additional Payroll Taxes", "Additional Deficit Spending", "Cuts to Other Programs"];
var dollar_raw = ["$2000", "$2250", "$2500", "$2750", "$3000"];

//Use math.random to randomly select traits for each dimension for both policies
var method_a = method_raw[Math.floor(Math.random()*method_raw.length)];
var gov_a = gov_raw[Math.floor(Math.random()*gov_raw.length)];
var party_a = party_raw[Math.floor(Math.random()*party_raw.length)];
var funding_a = funding_raw[Math.floor(Math.random()*funding_raw.length)];
var dollar_a = dollar_raw[Math.floor(Math.random()*dollar_raw.length)];

var method_b = method_raw[Math.floor(Math.random()*method_raw.length)];
var gov_b = gov_raw[Math.floor(Math.random()*gov_raw.length)];
var party_b = party_raw[Math.floor(Math.random()*party_raw.length)];
var funding_b = funding_raw[Math.floor(Math.random()*funding_raw.length)];
var dollar_b = dollar_raw[Math.floor(Math.random()*dollar_raw.length)];

// Take IndexOf the Dimension variable. This is the order of the Dimension variable
var method_index = attributes.indexOf("Method of Policy Implementation");
var gov_index = attributes.indexOf("Level of Government Responsible");
var party_index = attributes.indexOf("Governing Party Responsible");
var funding_index = attributes.indexOf("Method of Funding");
var dollar_index = attributes.indexOf("Monetary Equivalent of the Transfer");

//Use IndexOf Dimension and replace with appropriate trait for Policy A
att_a_traits[method_index] = method_a;
att_a_traits[gov_index] = gov_a;
att_a_traits[party_index] = party_a;
att_a_traits[funding_index] = funding_a;
att_a_traits[dollar_index] = dollar_a;

//Do the same for the second policy
att_b_traits[method_index] = method_b;
att_b_traits[gov_index] = gov_b;
att_b_traits[party_index] = party_b;
att_b_traits[funding_index] = funding_b;
att_b_traits[dollar_index] = dollar_b;

//Create the list of variables in the for loop
att_list = ["att1", "att2", "att3", "att4", "att5"];
a_list = ["a1", "a2", "a3", "a4", "a5"];
b_list = ["b1", "b2", "b3", "b4", "b5"];

//Tag id
for (i=0; i<5;i++){
document.getElementById(att_list[i]).innerHTML= attributes[i];
  document.getElementById(a_list[i]).innerHTML= att_a_traits[i];
  document.getElementById(b_list[i]).innerHTML= att_b_traits[i]; }

});


Leave a Reply