Welcome to the LimeSurvey Community Forum

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

Calculation to tally scores and make recommendation

  • misterdot
  • misterdot's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago - 5 years 7 months ago #172617 by misterdot
We're developing a survey to direct students to potential faculty advisers. The goal is to ask students about their interests, then make a recommendation on which faculty member would be a good match.

What I need to do is come up with a series of these types of equations:
if Q1 answer A, assign adviser2 1 point and adviser3 2 points.
if Q1 answer B, assign adviser1 2 points
if Q2 answer A, assign advisor4 1 point
...and so on

There are 8 single choice (radio) buttons and 4 total advisers. At the end of the survey, I want to tally the points and say, "based on your responses, adviser3 is your best match." I've been trying to read through the expression manager and equation documentation, but I'm having a tough time coming up with the initial logic/structure.

I've attached a screenshot of a sample question with scores in case it helps. Thanks in advance for any advice/guidance!

Last edit: 5 years 7 months ago by misterdot. Reason: added attachment
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago - 5 years 7 months ago #172621 by holch
[strike]And what does the screenshot tell us? What does "1" mean, what does "2" mean? Based on what would you asign the advisers? Sorry, but this is far from clear.[/strike]

I have read the first part again and I think I understand now what you want to do.

I would open an equation question type for each advisor and I would read in the different answers for each advisor.

Maybe Tpartner comes up with a cleaner idea, but I would check each checkbox by IF clauses and add upt values for each advisor.

After than you need a equation that checks which advisor has the most points.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 5 years 7 months ago by holch.
The topic has been locked.
  • misterdot
  • misterdot's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172623 by misterdot
Ah, sorry, those are points to be assigned to each adviser based on the response. So if, for example, they choose "social media for intervention," adviser1 and adviser4 each get a point. There are 8 total questions that look the same way, so we're keeping a running score for each adviser as students respond to the questions.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago - 5 years 7 months ago #172629 by tpartner
Yes, an equation question for each advisor would do it. An example equation for Advisor1, given two questions where they get ponits if:

- Q1 == A1, A2, A3 or A4
- Q2 == A4 or A5

Code:
{sum(if(Q1 == 'A1' OR Q1 == 'A2' OR Q1 == 'A3' OR Q1 == 'A4', 1, 0), if(Q2 == 'A4' OR Q2 == 'A5', 1, 0))}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 7 months ago by tpartner.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172631 by holch
I just saw now that it is a single choice question. In this case things are even simpler, aren't they? You don't need to sum anything. You just check which item is answered and then write the name of the advisors.

It is not an array question right? They just have to choose from a list of topics (second column)?

They would just see this simple list, but not the Advisors?

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172632 by tpartner

You don't need to sum anything. You just check which item is answered and then write the name of the advisors.

I think the graphic is simply to indicate which advisors get a point for each answer and that there are seven more similar list-radio questions. In that case, you would need to sum the results from all questions as my abbreviated example indicates.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172633 by holch
Makes sense. Otherwise the whole question wouldn't have made much sense.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • misterdot
  • misterdot's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172834 by misterdot
Thanks for the help so far! The last thing I'm stuck on is displaying the name of the highest scoring advisor. Since I'm using max(sum1,sum2,sum3,sum4), I get a numeric value and I can't figure out how to pull the question text (with the advisor's name) for that highest value. What's the best way to do that?

I'd also like to pull the second highest scoring advisor so I can say "your first recommendation is X, but you should also consider Y."

I've attached a simplified test survey if it helps.

File Attachment:

File Name: limesurvey...5673.lss
File Size:21 KB
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 7 months ago #172838 by Joffm
Hi,
are you sure that the highest score is unique? Or can there be more than one with the same - highest - score?

Then have a look at the example. Only for first place.

To find the second place you should create an equation that stores the first place and one to compare the rest excluding the first place.
like: second {if(rec1==first,max(rec2,rec3),rec2==first,max(rec1,rec3),max(rec1,rec2))}

File Attachment:

File Name: limesurvey...5673.lss
File Size:22 KB




Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
  • misterdot
  • misterdot's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172840 by misterdot

Joffm wrote: Hi,
are you sure that the highest score is unique? Or can there be more than one with the same - highest - score?


Yeah, it's possible there could be a tie (for first or second) and they won't be unique.
The topic has been locked.
  • misterdot
  • misterdot's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 7 months ago #172922 by misterdot
I've played with Joffm's comparison expressions (thank you!) and the fact that there can be ties is turning out to be a major issue.

One way around that is maybe just show all 4 advisers sorted by score in descending order - if they tie and one is arbitrarily listed first, that's ok in this case. That gets around trying to figure out definitively who is the highest.

Along those lines, I've been trying to sort the scores from highest to lowest using Javascript:

www.limesurvey.org/forum/can-i-do-this-w...isplay-sorted-values

Unfortunately, I'm not a coder so I haven't been able to get it right. Any suggestions for that? And is sorting indeed easier than trying to determine first and second? As I've been testing, I'm realizing that ties will be common - including the possibility of a 4-way tie for first.
The topic has been locked.
More
5 years 7 months ago #172925 by jelo

misterdot wrote: As I've been testing, I'm realizing that ties will be common - including the possibility of a 4-way tie for first.

If that is the case, what will sorting of all four advisers will change?

Your question/pointsystem might just need a different twist. Perhaps a few max-diff style question, where you capture not only what students interests the most, but also the least. And if you have a tie between interests, you ask one more question to minimize ties. Or you let them allocate points (e.g. 11) on interests to get more different weights.

LimeSurvey is missing an easy way to create dynamic lists. That would make it very easy without workarounds.
bugs.limesurvey.org/view.php?id=11688

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

Lime-years ahead

Online-surveys for every purse and purpose