Average counting in a special way

4 years 6 months ago #89052 by ezechial
ezechial created the topic: Average counting in a special way
Hello!

I'm new in this forum and I did not find an suitable answer for my problem:

Our company has a limesurvay, and I need to do a modification to one of our surveys. We need to count an average from answer in a way that it drops best, worse and a middle answers away ( in this way, we have charts to 4-10, and I need to drop 4, 7, and 10 off from average count) and count the average from the remaining numbers. Is this kind of modification possible and how I do it?

4 years 6 months ago #89148 by jelo
jelo replied the topic: Aw: Average counting in a special way
You can change the php code to get these results. But updates would be a problem and
you would need a special installation.

Such operations are more suitable for statistical programs.
Think about using R ( www.r-project.org ) on the Server to create a workflow for results.

Perhaps some day Limesurvey will support R inside the results sections but currently I would change the workflow to an external program which does the reports.

4 years 6 months ago #89158 by tpartner
tpartner replied the topic: Average counting in a special way
There may be a cleaner way to do this with Expression Manager but if, for example, you had an array question with:
- question code q1
- 4 sub-questions with codes 1-4

You could use something like the following in an equation question (I put in line-breaks to make it easier to read):
```{sum(
if(q1_1 > 0 && q1_1 != 4 && q1_1 != 7 && q1_1 != 10, q1_1, ''),
if(q1_2 > 0 && q1_2 != 4 && q1_2 != 7 && q1_2 != 10, q1_2, ''),
if(q1_3 > 0 && q1_3 != 4 && q1_3 != 7 && q1_3 != 10, q1_3, ''),
if(q1_4 > 0 && q1_4 != 4 && q1_4 != 7 && q1_4 != 10, q1_4, '')
) / count(
if(q1_1 > 0 && q1_1 != 4 && q1_1 != 7 && q1_1 != 10, 1, ''),
if(q1_2 > 0 && q1_2 != 4 && q1_2 != 7 && q1_2 != 10, 1, ''),
if(q1_3 > 0 && q1_3 != 4 && q1_3 != 7 && q1_3 != 10, 1, ''),
if(q1_4 > 0 && q1_4 != 4 && q1_4 != 7 && q1_4 != 10, 1, '')
)}```

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.