Welcome to the LimeSurvey Community Forum

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

Classification in an equation question

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 9 months ago #242852 by Vic1107
Please help us help you and fill where relevant:
Your LimeSurvey version: [see right hand bottom of your LimeSurvey admin screen]  Versión 3.25.10
Own server or LimeSurvey hosting: Own Server
Survey theme/template:
==================
(Write here your question/remark)
Hello to all members of the forum.

I'm struggling with something relatively easy but it's already consumed me more time than I expected.

I'm just trying to classify if he's a buyer or a non-buyer to control my odds.

I have a number of brands to evaluate

1. Sabritas
2. Marinela
3. Coke
4. Gamesa
5.Motorola
6.Samsung
7. Nike
8.Adidas
9.Apple

If they selected only these codes 1, 2, 3, 4, 6, 8 or 9 Classify as a "Regular" buyer
If they selected only these codes 5 or 7 Classify as an "Irregular" buyer
If they selected codes 1, 2, 3, 4, 6, 8 or 9 plus 5 or 7 Classify as an "Omnichannel" buyer

I'm doing everything in an "Equation" question but I can't land the idea correctly.

I thank everyone for the help.

Versión de LS: 3.25.10
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #242857 by Joffm
Replied by Joffm on topic Classification in an equation question
Hi,
would have been appreciated, if you showed your try.
This way we can show you what you missed or did wrong and you learn for the future.

One hint how I'd do it.
Function "countif"

Joffm 

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
1 year 9 months ago #242869 by jelo
Replied by jelo on topic Classification in an equation question

I'm doing everything in an "Equation" question but I can't land the idea correctly.
 
You might do it in four equations to keep complexity of each equation low. You already have written three in your post.
As Joffm wrote, attach anLSS export of the relevant questions here in forum.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users

Please Log in to join the conversation.

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 9 months ago #242905 by Vic1107
Replied by Vic1107 on topic Classification in an equation question
Hi guys,

Thank you very much for your comments, you are right... I forgot to attach an example of what I am telling you.

I share the Lss with these two questions, one with the multiple answer and the second with the Equation type where the result is stored.

Thank you both again for your prompt response.

 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
1 year 9 months ago #242908 by Joffm
Replied by Joffm on topic Classification in an equation question
Hi,
first, what is wrong in your approach?
{if(Q12_1.NAOK=="Y",if(Q12_2.NAOK=="Y",if(Q12_3.NAOK=="Y",if(Q12_4.NAOK=="Y",if(Q12_6.NAOK=="Y",if(Q12_8.NAOK=="Y",if(Q12_9.NAOK=="Y","Comprador regular","")))))))}
Nearly correct, but you also get this result if the respondent selects Q12_1 and Q12_5 . You have to exclude the irregular items.

The second is analogue.

And here
{if(Q12_1.NAOK=="Y",if(Q12_2.NAOK=="Y",if(Q12_3.NAOK=="Y",if(Q12_4.NAOK=="Y",if(Q12_6.NAOK=="Y",if(Q12_8.NAOK=="Y",if(Q12_9.NAOK=="Y",if(Q12_7.NAOK=="Y","Comprador Omnicanal",""))))))))}

What about Q12_5?
And if the respondent selects Q12_1 he is both "regular" and "omnicanal". The rest of the nested IF is not taken onto account, after one condition is TRUE.

Now the solutions:
If you use the "that" variable it is really short
Read the manual about it
[url] www.limesurvey.org/manual/ExpressionScri....22that.22_variables [/url]

To be able to use it you should recode the items like
 
You see, the regular items start with "R", the irregular with "I"

Now you can say:
{if(count(that.Q12.sq_R)>0 AND count(that.Q12.sq_I)>0,"Comprador omnicanal",if(count(that.Q12.sq_R)>0,"Comprador regular","Comprador irregular"))}

Meaning:
You count the number of selected items where the code contains an "R" (count(that.Q12.sq_R) and 
the number of selected items where the code contains an "I" (count(that.Q12.sq_I).

Now the first part of the nested IF
If both give a result greater 0, items of both categories have been selected --> omnicanal
Second part:
ELSE (not both greater 0)
if the number of "R" items is greater 0 --> regular
ELSE (not both greater 0, not "R" greater 0)
it is irregular.

Here you see, how this construct with the "that" variable is expanded
 
So without the recoding of your items you also can write the equation like this, the long version
{if(count(Q12_1, Q12_2, Q12_3, Q12_4, Q12_6, Q12_8, Q12_9) > 0 AND count(Q12_5, Q12_7) > 0, "Comprador omnichannel", if(count(Q12_1, Q12_2, Q12_3, Q12_4, Q12_6, Q12_8, Q12_9) > 0, "Comprador regular", "Comprador irregular"))}

 

File Attachment:

File Name: limesurvey...6_JK.lss
File Size:22 KB

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • Vic1107
  • Vic1107's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
1 year 9 months ago #242909 by Vic1107
Replied by Vic1107 on topic Classification in an equation question
Thank you very much Joffm.

It really is something simple but I think I need to take a look at the manuals to learn more about expressions.

I send you a big hug.

Greetings,

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose