Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing a software algorithm at the moment which compares survey answers.

Questions have $5$ possible answers, and a respondent could choose between 1 and 5 answers.

What I'd like to do, for each respondent, for each question, is calculate how strongly they feel about their answer.

I propose to do this by counting the number of answers they selected.

For example, suppose the question was:

Which of these colours do you like?

And the possible answers were:

a) Blue b) Red c) Green d) Orange e) Purple

Then someone who answers only b), feels more strongly about their answer than someone who selected all 5.

What I'm having trouble with, is how to account for the different numbers of possible answers. If a question has a yes or no answer, and the respondent only chooses one answer, we want to consider this as being less significant than if they only choose one answer on a question with more possible options.

So the more options to choose from, the higher the importance of each answer selected.

So far, I've come up with this:

$$i = \text{max} - (\frac{g}{n} * \text{max})$$


  • $i$ (importance)

  • max (maximum importance %) $= 100$

  • $p$ (possible answers)

  • $g$ (given answers)

Can anybody suggest how I could approach this problem differently or improve the formula?


share|cite|improve this question
Looks as good as any (I guess you meant $p$ when you wrote $n$). You can also do the exponential weighing $i=100e^{-cg/p}$ with some reasonable $c>0$. It all depends on what exactly you mean by the "strength of the feeling". You know, if I'm asked "Was Hitler a good man?" (Y/N) and answer "No" and if I'm asked "Do you like grapefruits?" (Y/N) and still answer "No", the strength of my feelings is very different but any formula you can think of will output the same $i(1,2)$ value ;). – fedja Feb 15 '13 at 19:01
Thanks - I get your point about the options and how strongly respondents feel about it. It makes sense with our questions – bodacious Feb 16 '13 at 20:00

You could try using a weighting system based on the user's choices.

The weights would be from high to low and give you a scaling factor to account for the significance of their choice.

For example:

  • $w_n = 6 - n$ (where $n$ = number of color choices, that is $1$ to $5$)

So, if a user choose a single color, she would get a weight, $w = 5$, since she had a very strong preference for a single color. However, she would get a weight of, $w = 4$ if she had a preference for two and only a weight, $w = 1$ if she chose them all. Of course, a weight of zero if she did not answer is assumed.

Use this to generate a score for each user. However, you may also want your stats to come out a certain way and to be inclusive of trends and predilections and bias to the choice of colors given.

This could be used with some nonlinear characteristics and weighting function to determine appropriate weight values based on user choices.


share|cite|improve this answer
Very helpful suggestions! I hope they "took" ;-) +1 – amWhy May 3 '13 at 0:12
So so day for something soon! Relax (easier said than done), and maybe turn in early for some extra "snooze" time! – amWhy May 3 '13 at 0:21

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.