Welcome to the LimeSurvey Community Forum

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

Score items in double matrix

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 months 6 days ago #250543 by Episteme Investigación e Intervención Social
Score items in double matrix was created by Episteme Investigación e Intervención Social
Hi Lime Community,
I want to score regular and irregular items on a double matrix but I don't know how to call each item in this type of question to make the equation.
I usually write the equation like this:

Total: {sum(sum(that.Q1.sq_R.NAOK),4*count(that.Q1.sq_I.NAOK)-sum(that.Q1.sq_I.NAOK))}
if I have a matrix in Q1 and some R (regular items) and I (irregular items) as questions with 5 types of responses (scoring from 0 to 4) as follows:
 
 

But how can I call the items in a equation if it is a double matrix to separate the score for each scale (tobaco vs. vapers)? like this:
 
 

If I put the same equation it shows an error when you want to previsualize it:
 
 

How can a call each scale (0, tobaco, and 1, vapers) to calculate the total score when regular and irregular items?

Thank you very much!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 months 6 days ago - 7 months 6 days ago #250547 by Joffm
Replied by Joffm on topic Score items in double matrix
As you see in the screenshot your actual equation takes into account both scales
That is because you only say
that.Q1.sq_R.NAOK.
So all cells that contain a "R" are calculated.

The first idea is:
Add the index of the scale as described here
[url] manual.limesurvey.org/ExpressionScript_-...code_variable_naming [/url] QuestionCode . '_' . SubQuestionID . '_' . ScaleId

To calculate only the first scale it should be: that.Q1.sq_R_0.NAOK.
and the second: that.Q1.sq_R_1.NAOK.

BUT this doesn't work.
You can't add something after the part that is expanded ("R"). ExpressionScript doesn't know, what exactly to expand.

So you have to add the variables one by one like
Scale 1:  {sum(sum(Q1_R1_0.NAOK,Q1_R2_0.NAOK,Q1_R3_0.NAOK,Q1_R4_0.NAOK),4*count(Q1_I5_0.NAOK,Q1_I6_0.NAOK,Q1_I7_0.NAOK)-sum(Q1_I5_0.NAOK,Q1_I6_0.NAOK,Q1_I7_0.NAOK))}

Scale 2: {sum(sum(Q1_R1_1.NAOK,Q1_R2_1.NAOK,Q1_R3_1.NAOK,Q1_R4_1.NAOK),4*count(Q1_I5_1.NAOK,Q1_I6_1.NAOK,Q1_I7_1.NAOK)-sum(Q1_I5_1.NAOK,Q1_I6_1.NAOK,Q1_I7_1.NAOK))}

 

Joffm

The error message is not related to this.
It only says that you created a group that does not contain questions yet.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 7 months 6 days ago by Joffm.

Please Log in to join the conversation.

  • Episteme Investigación e Intervención Social
  • Episteme Investigación e Intervención Social's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 months 6 days ago #250555 by Episteme Investigación e Intervención Social
Replied by Episteme Investigación e Intervención Social on topic Score items in double matrix
that's just what I wanted, it works perfectly.
Thank you very much Joff.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose