- Posts: 26
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to score the higher value in multiple choice questions in an equation
- Episteme Investigación e Intervención Social
- Topic Author
- Offline
- Junior Member
Less
More
8 months 2 days ago - 8 months 2 days ago #246091
by Episteme Investigación e Intervención Social
How to score the higher value in multiple choice questions in an equation was created by Episteme Investigación e Intervención Social
Hi Lime Comunity,
I have a question about how to make an equation. I have a scale that needs to be scored as it follows: For each item, add the highest weight selected. If more than one answer is selected, use the highest. Sum all the items.
I don't know how to make the equation to select just to sum the highest value of each question.
Also I can't select the survey as valoration so I don't have the possibility of having same values for different answers as this:
instead of this, for example:
I attached the .LSS with some question examples of the scale.
Thank you very much!
I have a question about how to make an equation. I have a scale that needs to be scored as it follows: For each item, add the highest weight selected. If more than one answer is selected, use the highest. Sum all the items.
I don't know how to make the equation to select just to sum the highest value of each question.
Also I can't select the survey as valoration so I don't have the possibility of having same values for different answers as this:
instead of this, for example:
I attached the .LSS with some question examples of the scale.
Thank you very much!
Last edit: 8 months 2 days ago by Episteme Investigación e Intervención Social.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
8 months 2 days ago - 8 months 2 days ago #246093
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to score the higher value in multiple choice questions in an equation
You are using "multiple" question.
So each subquestion can be selected or not. Therefore there is no weighting.
So how do you want to calculate your score?
Of course you can check which subquestions were selected and take the "highest". What is it? The one with the highest subquestion code?
Here an example:
How do you want to calculate?
So each subquestion can be selected or not. Therefore there is no weighting.
So how do you want to calculate your score?
Of course you can check which subquestions were selected and take the "highest". What is it? The one with the highest subquestion code?
Here an example:
How do you want to calculate?
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 8 months 2 days ago by Joffm.
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
8 months 2 days ago #246096
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to score the higher value in multiple choice questions in an equation
If you want to sum the highest subquestion code of each question you can do it in different ways.
1. with the IF function (if the subquestion is selected, the compared value is x else 0. You see x must not match the subquestion code.
{sum(max(if(Q1_1=="Y",1,0),if(Q1_2=="Y",2,0),if(Q1_3=="Y",3,0),if(Q1_4=="Y",4,0),if(Q1_5=="Y",5,0)),max(if(Q2_1=="Y",1,0),if(Q2_2=="Y",2,0),if(Q2_3=="Y",3,0),if(Q2_4=="Y",4,0)),max(if(Q3_1=="Y",1,0), if(Q3_3=="Y",3,0),if(Q3_4=="Y",4,0),if(Q3_5=="Y",5,0),if(Q3_6=="Y",6,0)),Q4.valueNAOK)}
2. More or less the same, but with the function "intval" knowing that "intval(TRUE)" is 1 else 0. Again the used factor must not match the subquestion code.
{sum(max(1*intval(Q1_1=="Y"),2*intval(Q1_2=="Y"),3*intval(Q1_3=="Y"),4*intval(Q1_4=="Y"),5*intval(Q1_5=="Y")),max(1*intval(Q2_1=="Y"),2*intval(Q2_2=="Y"),3*intval(Q2_3=="Y"),4*intval(Q2_4=="Y")),max(1*intval(Q3_1=="Y"),3*intval(Q3_3=="Y"),4*intval(Q3_4=="Y"),5*intval(Q3_5=="Y"),6*intval(Q3_5=="Y")),Q4.valueNAOK)}
and at last you sum the assessment value of Q4.
You see it is only a little bit of arithmetic and the knowledge of some functions "if", "max", "intval"
Joffm
1. with the IF function (if the subquestion is selected, the compared value is x else 0. You see x must not match the subquestion code.
{sum(max(if(Q1_1=="Y",1,0),if(Q1_2=="Y",2,0),if(Q1_3=="Y",3,0),if(Q1_4=="Y",4,0),if(Q1_5=="Y",5,0)),max(if(Q2_1=="Y",1,0),if(Q2_2=="Y",2,0),if(Q2_3=="Y",3,0),if(Q2_4=="Y",4,0)),max(if(Q3_1=="Y",1,0), if(Q3_3=="Y",3,0),if(Q3_4=="Y",4,0),if(Q3_5=="Y",5,0),if(Q3_6=="Y",6,0)),Q4.valueNAOK)}
2. More or less the same, but with the function "intval" knowing that "intval(TRUE)" is 1 else 0. Again the used factor must not match the subquestion code.
{sum(max(1*intval(Q1_1=="Y"),2*intval(Q1_2=="Y"),3*intval(Q1_3=="Y"),4*intval(Q1_4=="Y"),5*intval(Q1_5=="Y")),max(1*intval(Q2_1=="Y"),2*intval(Q2_2=="Y"),3*intval(Q2_3=="Y"),4*intval(Q2_4=="Y")),max(1*intval(Q3_1=="Y"),3*intval(Q3_3=="Y"),4*intval(Q3_4=="Y"),5*intval(Q3_5=="Y"),6*intval(Q3_5=="Y")),Q4.valueNAOK)}
and at last you sum the assessment value of Q4.
You see it is only a little bit of arithmetic and the knowledge of some functions "if", "max", "intval"
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12943
- Thank you received: 3979
8 months 1 day ago #246101
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to score the higher value in multiple choice questions in an equation
Here is a third approach with a nested If without the "max" function.
The idea is:
Start at the highest code. If the subquestion is selected, fine, you found it.
{sum(if(Q1_5=="Y",5,if(Q1_4=="Y",4,if(Q1_3=="Y",3,if(Q1_2=="Y",2,if(Q1_1=="Y",1,0))))),if(Q2_4=="Y",4,if(Q2_3=="Y",3,if(Q2_2=="Y",2,if(Q2_1=="Y",1,0)))),if(Q3_6=="Y",6,if(Q3_5=="Y",5,if(Q3_4=="Y",4,if(Q3_3=="Y",3,if(Q3_1=="Y",1,0))))),Q4.valueNAOK)}
I hope you found the typo in the previous post
{sum(max(1*intval(Q1_1=="Y"),2*intval(Q1_2=="Y"),3*intval(Q1_3=="Y"),4*intval(Q1_4=="Y"),5*intval(Q1_5=="Y")),max(1*intval(Q2_1=="Y"),2*intval(Q2_2=="Y"),3*intval(Q2_3=="Y"),4*intval(Q2_4=="Y")),max(1*intval(Q3_1=="Y"),3*intval(Q3_3=="Y"),4*intval(Q3_4=="Y"),5*intval(Q3_5=="Y"),6*intval(Q3_6 =="Y")),Q4.valueNAOK)}
By the way:
Do you want to store this score?
Or only display it to the respondent?
If you want to store it, you have to use a question of type equation (eqScore) (as you did), but remove everything but the formula.
To display it, use a question of type "text display", where you show your text and pipe the calculated score, like
In the previous questions you reached a score of {eqScore}
The idea is:
Start at the highest code. If the subquestion is selected, fine, you found it.
{sum(if(Q1_5=="Y",5,if(Q1_4=="Y",4,if(Q1_3=="Y",3,if(Q1_2=="Y",2,if(Q1_1=="Y",1,0))))),if(Q2_4=="Y",4,if(Q2_3=="Y",3,if(Q2_2=="Y",2,if(Q2_1=="Y",1,0)))),if(Q3_6=="Y",6,if(Q3_5=="Y",5,if(Q3_4=="Y",4,if(Q3_3=="Y",3,if(Q3_1=="Y",1,0))))),Q4.valueNAOK)}
I hope you found the typo in the previous post
{sum(max(1*intval(Q1_1=="Y"),2*intval(Q1_2=="Y"),3*intval(Q1_3=="Y"),4*intval(Q1_4=="Y"),5*intval(Q1_5=="Y")),max(1*intval(Q2_1=="Y"),2*intval(Q2_2=="Y"),3*intval(Q2_3=="Y"),4*intval(Q2_4=="Y")),max(1*intval(Q3_1=="Y"),3*intval(Q3_3=="Y"),4*intval(Q3_4=="Y"),5*intval(Q3_5=="Y"),6*intval(Q3_6 =="Y")),Q4.valueNAOK)}
By the way:
Do you want to store this score?
Or only display it to the respondent?
If you want to store it, you have to use a question of type equation (eqScore) (as you did), but remove everything but the formula.
To display it, use a question of type "text display", where you show your text and pipe the calculated score, like
In the previous questions you reached a score of {eqScore}
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Please Log in to join the conversation.