Welcome to the LimeSurvey Community Forum

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

Conjoint Analysis with some conditions

  • RitaShen
  • RitaShen's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 1 day ago #242825 by RitaShen
Conjoint Analysis with some conditions was created by RitaShen
Please help us help you and fill where relevant:
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
 

File Attachment:

File Name: limesurvey...7684.lss
File Size:97 KB

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
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 21 hours ago #242836 by Joffm
Replied by Joffm on topic Conjoint Analysis with some conditions
Something like this?
{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
  • RitaShen's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
1 year 10 hours ago - 1 year 10 hours ago #242853 by RitaShen
Replied by RitaShen on topic Conjoint Analysis with some conditions
is that mean Condition 1 appears as 2, Condition 2 cannot appear as 3l or 4.

and is this equation can use in Conjoint Analysis?
Last edit: 1 year 10 hours ago by RitaShen.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 3 hours ago #242858 by Joffm
Replied by Joffm on topic Conjoint Analysis with some conditions
Okay:
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"
Code:
<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
  • RitaShen's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
11 months 3 weeks ago - 11 months 3 weeks ago #243127 by RitaShen
Replied by RitaShen on topic Conjoint Analysis with some conditions
Hi Joffm,

I have followed the code,
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?
 

File Attachment:

File Name: limesurvey...4988.lss
File Size:26 KB


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:
Code:
{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

 
Last edit: 11 months 3 weeks ago by RitaShen.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 3 weeks ago #243128 by Joffm
Replied by Joffm on topic Conjoint Analysis with some conditions
Hi, Rita,

sorry, I do not understand why you suddenly wish a dependency between random5 and random6

this was your original code
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
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 3 weeks ago - 11 months 3 weeks ago #243129 by Joffm
Replied by Joffm on topic Conjoint Analysis with some conditions
Hi,
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
Last edit: 11 months 3 weeks ago by Joffm.

Please Log in to join the conversation.

  • RitaShen
  • RitaShen's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
11 months 3 weeks ago #243130 by RitaShen
Replied by RitaShen on topic Conjoint Analysis with some conditions
Dear Joffm,

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
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 3 weeks ago #243131 by Joffm
Replied by Joffm on topic Conjoint Analysis with some conditions
Well,

and if in the first column there is DPP then in the second column there is only NPP and TPP?

That's the already shown code (if the second column is random6)
{if(is_empty(random6,if(random5==2,rand(3, 4), rand(1,4)),random6)}

And here you said

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,

Now, please, decide about your naming.
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
  • RitaShen's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
11 months 3 weeks ago - 11 months 3 weeks ago #243132 by RitaShen
Replied by RitaShen on topic Conjoint Analysis with some conditions
Dear Joffm,

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
 
Last edit: 11 months 3 weeks ago by RitaShen.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 3 weeks ago - 11 months 3 weeks ago #243138 by Joffm
Replied by Joffm on topic Conjoint Analysis with some conditions
What is the content of the cell.
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
Last edit: 11 months 3 weeks ago by Joffm.

Please Log in to join the conversation.

  • RitaShen
  • RitaShen's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
11 months 3 weeks ago #243139 by RitaShen
Replied by RitaShen on topic Conjoint Analysis with some conditions
 Joffm

here is the syntax  in my cell
 

Rita

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose