- Posts: 114
- Thank you received: 1
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Conjoint Analysis with some conditions
- RitaShen
- Topic Author
- Offline
- Premium Member
Your LimeSurvey version:5.6.14
Own server or LimeSurvey hosting: LimeSurvey hosting
Survey theme/template: Bootswatch
==================
Hi there,
I have a question about Conjoint Analysis,
there are two conditions in my conjoint,
condition1: KMT/DPP/NPP/TPP/NP
condition2: lower high school/high school/Undergraduate/Graduate
If Condition 1 appears as DPP, Condition 2 cannot appear as lower high school or high school.
How can I do this in Conjoint Analysis?
thanks
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
- Posts: 12941
- Thank you received: 3979
{if(is_empty(random7),if(random5==2,rand(3, 4), rand(1,4)),random7)}
for all of these random numbers
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- RitaShen
- Topic Author
- Offline
- Premium Member
- Posts: 114
- Thank you received: 1
and is this equation can use in Conjoint Analysis?
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
- Posts: 12941
- Thank you received: 3979
with "random5" you select one option out of "1 = KMT/ 2 = DPP/ 3 = NPP/ 4 = TPP/ 5 = NP"
and "random7" selects the degree "1 = lower high school/ 2 = high school/ 3 = Undergraduate/ 4 = Graduate"
<td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random5== 1, 'KMT',if(random5== 2, 'DPP',if(random5== 3, 'NPP',if(random5== 4, 'TPP','NA'))))}</span></span></strong></span></td> <td bgcolor="#f2f2f2" style="text-align: center;"><p><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random7== 1, 'lower high school',if(random7== 2, 'high school',if(random7== 3, 'Under Graduate','Graduate')))}</span></span></strong></span></p>
Of course analogue for "random6" and "random8"
Now my proposal:
{if(is_empty(random7),if(random5==2,rand(3, 4), rand(1,4)),random7)}
It is only:
If "random5" is equal 2 (DPP) then "random7" is a random number from 3-4, so 1(Lower high school) and 2(high school) will not be selected.
If "random5" is not equal 2 then "random7" is a random number from 1-4, so all degrees are possible.
Of course everything surrounded by the usual construct "if(!is_empty(randonnumber), "
I think this was your requirement.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- RitaShen
- Topic Author
- Offline
- Premium Member
- Posts: 114
- Thank you received: 1
I have followed the code,
{if(random5== 1, 'KMT',if(random5== 2, 'DPP',if(random5== 3, 'NPP',if(random5== 4, 'TPP','NA'))))} {if(is_empty(random6),if(random5==2,rand(3, 4), rand(1,4)),random6)}
but if random 5 is equal 2 (DPP), random6 will appear 1 or 2, May I know which step I have done incorrectly?
for random6, can I use the word to replace the number?
random6 "1 = lower high school/ 2 = high school/ 3 = Undergraduate/ 4 = Graduate"
If I have two condition:
1. random 5 is equal 2 (DPP), random6 will appear 1 or3 or 4,
2. random 5 is equal 1 (KMT), random6 will appear 2 to 4,
is the code written like this:
{if(is_empty(random6),if(random5==2,rand(1, 3, 4), rand(1,4)),random6),if(is_empty(random6),if(random5==1,rand(2, 3, 4), rand(1,4)),random6), }
Thanks
Rita
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
- Posts: 12941
- Thank you received: 3979
sorry, I do not understand why you suddenly wish a dependency between random5 and random6
this was your original code
<tr> <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">黨籍</span></span></strong></span></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random5== 1, 'KMT',if(random5== 2, 'DPP',if(random5== 3, 'NPP',if(random5== 4, 'TPP','NA'))))}</span></span></strong></span></td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random6== 1, 'KMT',if(random6== 2, 'DPP',if(random6== 3, 'NPP',if(random6== 4, 'TPP','NA'))))}</span></span></strong></span></td> </tr> <tr style="height: 6px; text-align: center;"> </tr> <tr> <td bgcolor="#f2f2f2" style="text-align: center;"> <p><span style="font-size:20px;"><strong><span style="color:#000000;"> <font face="標楷體">學歷</font></span></strong></span></p> <p><span style="font-size:20px;"><strong><span style="color:#000000;"><font face="標楷體">前一份工作</font></span></strong></span></p> </td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"> <p><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random7== 1, 'lower high school',if(random7== 2, 'high school',if(random7== 3, 'Under Graduate','Graduate')))}</span></span></strong></span></p> </td> <td style="text-align: center;" width="1%"> </td> <td bgcolor="#f2f2f2" style="text-align: center;"><span style="font-size:20px;"><strong><span style="color:#000000;"><span style="font-family:標楷體;">{if(random8== 1, 'lower high school',if(random8== 2, 'high school',if(random8== 3, 'Under Graduate','Graduate')))}</span></span></strong></span></td> </tr>
And this was your requirement
condition1: KMT/DPP/NPP/TPP/NP (this is random5 - in the first column, resp. random6 in the second column)
condition2: lower high school/high school/Undergraduate/Graduate (this is random7 - in the first column, resp. random8 in the second column)
If Condition 1 appears as DPP, Condition 2 cannot appear as lower high school or high school.
So there is only a dependency of random5 and random7 (resp. random6 and random8).
And this was, what I showed
{if(is_empty(random7),if(random5==2,rand(3, 4), rand(1,4)),random7)}
It is only:
If "random5" is equal 2 (DPP) then "random7" is a random number from 3-4, so 1(Lower high school) and 2(high school) will not be selected.
If "random5" is not equal 2 then "random7" is a random number from 1-4, so all degrees are possible.
Of course everything surrounded by the usual construct "if(!is_empty(randonnumber), "
I think this was your requirement.
Now you require a dependecy between random5 and random6
Does it mean: If in the first column there is DPP then in the second column there is only NPP and TPP?
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
- Posts: 12941
- Thank you received: 3979
why did you change your assignments:
In the original code
random5 and random6 were the "DPP/NPP/TPP" stuff
random7 and random8 were the degrees
Now you say:
random6 "1 = lower high school/ 2 = high school/ 3 = Undergraduate/ 4 = Graduate"
Do you want to confuse yourself or confuse us?
BTW:
You entered the equation into the question code of your table.
Of course you have to enter it as the alternative creation of the random number.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- RitaShen
- Topic Author
- Offline
- Premium Member
- Posts: 114
- Thank you received: 1
I apologize for any inconvenience caused, as your idea is indeed correct.
require a dependency between random5 and random6
and if in the first column there is DPP then in the second column there is only NPP and TPP?
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
- Posts: 12941
- Thank you received: 3979
That's the already shown code (if the second column is random6)and if in the first column there is DPP then in the second column there is only NPP and TPP?
{if(is_empty(random6,if(random5==2,rand(3, 4), rand(1,4)),random6)}
And here you said
Now, please, decide about your naming.for random6, can I use the word to replace the number?
random6 "1 = lower high school/ 2 = high school/ 3 = Undergraduate/ 4 = Graduate"
If I have two condition:
1. random 5 is equal 2 (DPP), random6 will appear 1 or3 or 4,
2. random 5 is equal 1 (KMT), random6 will appear 2 to 4,
What exactly is selected by random5, random6, random7 and rendom8?
Now you know that the "rand(x,y)" function requires two parameters,
So this is wrong syntax
{if(is_empty(random6),if(random5==2,rand(1, 3, 4), rand(1,4)),random6)}
The simple solution is to recode the items of the degree.
The other is to remember some arithmetic at school.
{if(is_empty(random6),if(random5==2,round(1.3*rand(1,3)), rand(1,4)),random6)}
rand(1,3) selects a random number 1, 2 or 3
so the result of 1.3*rand(1,3) is 1.3, 2.6 or 3.9
And after rounding you have your desired 1,3 and 4
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- RitaShen
- Topic Author
- Offline
- Premium Member
- Posts: 114
- Thank you received: 1
I would like to express my sincere appreciation for your assistance, and my deepest apologies for any inconvenience caused. Initially, I had intended to simplify the table before seeking your guidance, but it appears that my actions have caused you some trouble. I deeply regret any inconvenience this may have caused you, and I am truly sorry.
And I've followed your code:
{if(is_empty(random6),if(random5==2,round(1.3*rand(1,3)), rand(1,4)),random6)}
rand(1,3) selects a random number 1, 2 or 3
so the result of 1.3*rand(1,3) is 1.3, 2.6 or 3.9
And after rounding you have your desired 1,3 and 4
However, when I tested it, the number 2 still appeared.
Rita
Please Log in to join the conversation.
- Joffm
- Away
- LimeSurvey Community Team
- Posts: 12941
- Thank you received: 3979
I assume you entered the formula to create the random number.
No, you just replace your old
with
And in the table cell it is still
{if(random7== 1, 'KMT',if(random=7= 2, 'DPP',if(random7== 3, 'NPP',if(random7== 4, 'TPP','NA'))))}
or whatever
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- RitaShen
- Topic Author
- Offline
- Premium Member
- Posts: 114
- Thank you received: 1
Please Log in to join the conversation.