Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Tailored CBC question with "CBCDesignLevelText"

Dear Sawtooth users,

I am facing a simingly simple question but which is, apparently, not easy to solve.

I have a CBC exercise in which one of the attribute is yearly savings (in monetary terms). Another attribute is the uncertainty regarding the above saving, in %. Uncertainty is going to be displayed as "+- 10%", "+-50%" etc. However, since people tend to be bad with % we want to include the potential monetary variation as well to help them. For instance if an alternative's yearly savings attribute is "500 USD" and then we would like the uncertainty attribute to display something like "+- 10% (+- 50 USD)", "+- 50% (+- 250 USD)", etc.

Basically what I need is to find a way to tailor the "uncertainty attribute" with some kind of fency unverified pearl function that gets the value of the displayed yearly savings.

I am pretty sure there is something that can be done with the function
CBCDesignLevelText


But I did not manage to find a way to make it work in this context.

Many thanks in advance for any hint you may have!
asked Jul 30, 2014 by Albatus Bronze (545 points)
retagged Jul 30, 2014 by Walter Williams

1 Answer

0 votes
Albatus,
Have you considered using a conditional relationship?  From the Attributes tab, click on the Conditional Relationships button.   Make a table based on the two attributes -- savings amount and percent uncertainty.  Make it a conditional display,  with the "Position in Concept" setting set to replace the percent uncertainty attribute.  Then, simply fill out the table with the text and calculations for each pair.  You'll have to fill out a full combination of savings amount x percent uncertainty rows, but this should be sped up if you use a spreadsheet and copy and paste.
answered Jul 30, 2014 by Gary Baker Silver Sawtooth Software, Inc. (7,800 points)
It seems indeed to be a good way to do it and I tried, However I keep getting error messages while trying to load the DCE;

I'll try to explain what I'm doing:

In my choice experiment the attribute "Cost savings" is itself pivoted from a previous answer and equals 10, 20, 30, 40, 50 or 60% of the current heating costs. The "heatingcost" question is a select question where there can basically say either 1) "I know my heating costs" and disclose the amount in the "specify" box next to it OR 2) "I don't know my heating costs".

Next, in the choice experiment the "cost savings" attribute is tailored based on the above "heatingcost" answers; if respondents didn't disclose their heating costs we assume them to be 2000 USD, hence the first level (10% savings) of the "cost savings attribute" is defined as:

[% Begin Unverified Perl
if((VALUE('heatingcost')==1))
{
    return ROUND(0.1*VALUE("heatingcost_1_other"),0);
}

else
{
    return "200";
}
End Unverified %]


etc for the next levels. This works perfeclty fine.

Now, what I am trying to do like I explained in the original post is to provide a monetary indication for the "uncertainty" attribute. If in a given alternative the cost savings are 10% and the uncertainty 10%, then the final goal is to have the uncertainty attribute displaying "10% (+- 30 USD)" (in the case of someone who disclosed 3000 USD in the "heatingcosts" question) or "10% (+- 20 USD)" (in the case of someone who did not disclode its costs, hence assumed to be 2000 USD.

10% (+- [% Begin Unverified Perl 
if((VALUE('heatingcost')==1)) 
{     return 0.1*(ROUND(0.1*VALUE("heatingcost_1_other"),0)); 
}  
else
 {     return "20"; }) 
End Unverified %] USD)


I hope I was clear enough. Do you see where the problem is?
If you've pasted your code verbatim, is it the extra parenthesis at the end of line 6?
Nope, the extra ) was a typo indeed. But I found the problem (which was completly unrelated). Hence for anyone who might be interested the above code works just fine :-)

However this is still a kind of "second best" trick; I have to go back to the "heatingcost" question and retrieve what respondents said there. The 1st-best option (which I didn't manage to implement) would be to look directly at the displayed text of the "Cost savings" attribute of each alternatives during each choice experiment tasks. In my case it works (because I relate both the "cost savings" and "uncertainty" attributes to the underlying question "heatingcosts").

Any idea how the 1st-best option could be implemented?
This could be done with some of your own HTML, CSS, and JavaScript.  I believe an approach similar to the third answer in this post would work:

https://sawtoothsoftware.com/forum/2090/javascript-looking-design-and-computign-the-price-display
...