Page 1 of 1

Scoring a Quiz

Posted: Sun Jul 06, 2008 3:05 pm
by cesarcesar
I making a personality quiz that goes like the following.

User takes a test to determine which type of person they are more like. So there will be say 5 types, each given a percentage of 100 that they are closest to at quiz end. The test has 50 questions, plus a age question and a sex question. Each test has 5 possible answers. The user clicks through radio button to fill out the quiz. No sweat so far.

My issue is in the test scoring, this is were i get confused. When making a test, each answer is weighted to fit a specific personality type. The weights are shown on screen as +6 thru 0 thru -6. (In code as 1-13, zero the default get 7 points). I have tried a few different scoring algos but non seem to be accurate. One other thing, I have to assume that a value other than zero WILL NOT be chosen when building a quiz.

1st try - Multiple count of all questions times 7 (7 is middle or 0 on scale), then divide by total points gotten from weighted answers. This ends up being something like 350/372 = 94%. This is all good till you get a score like 350/352 = 99%. In percentage you can assume that the second score is higher, but in reality the first score had the greater point spread.

2nd try - Add the highest value (up to 13) from each questions answers together for each personality type, then divide by total points gotten from weighted answers. This ends up something similar to the above try, but with higher percentages going to those personality types with answers that have no weights attached to them.

OK so now that i have written this Im really thinking that the quizzes will not work if weights are not set to other than zero (aka 7 points). Am I totally off here? Can anyone lead me in a proper direction. Thanks much for helping my keep what hair is left on my head.

Cesar

Re: Scoring a Quiz

Posted: Sun Jul 06, 2008 3:32 pm
by califdon
You have given a pretty good word description of the problem, but I don't quite understand your scoring method. For a particular question, will each of the 5 possible answers contribute to just ONE personality type, or will it contribute a weighted amount to ALL personality types? In other words, if all answers to all questions contribute SOME factor to ALL personality types, you're talking about quite a large matrix--I believe it would be 5 * 50 * 5 = 1250 values that must be specified! If that's the case, I think I would consider storing the factors in a table, perhaps with a structure like:

Code: Select all

[b]tblFactors:[/b]
  questionID
  factorA1 (A-E being the answers, 1-5 being the Personality Types)
  factorA2
  ...
  factorA5
  factorB1
  ...
  factorC1
  ...
  factorD1
  ...
  factorE5
But if there's a simpler relationship between the answers and the Personality types, I haven't grasped it.

Re: Scoring a Quiz

Posted: Sun Jul 06, 2008 3:40 pm
by cesarcesar
thanks for replying.

Each question has 5 multiple choice answers. Each answer has 5 different weight values, one for each personality type. Therefor each question has will contribute some points towards each personality type.

Hope that helps.

Re: Scoring a Quiz

Posted: Sun Jul 06, 2008 4:32 pm
by califdon
OK, so that's a matrix of 1250 weight values. Since you clearly don't want to code that into the script, you have to decide how you will store the matrix. As you are scoring a respondent's answers, question by question, you will need to accumulate values in an array until you have scored all 50 questions. Then you will have totals for the 5 personality types. You should be able to easily convert that into a percentage score. [Edit: Actually, you could simply accumulate in 5 variables, no real need for an array.]

So what I see as the elements of calculation would be:
  • As you consider the answer to each question, you need to lookup 5 values, one for each personality type, and accumulate these in an array with 5 elements, one for each personality type.
  • In order to do that, you need to have the weight values stored in a table that can return a weight value based on which Question, which Answer and which Personality Type.
So I see the first challenge to be how to design the table in which to store the 1250 weight values in such a way that you can look them up as you read the answer to each question.

There might be a better design, perhaps using 2 related tables, but I think I'd start off with the structure I suggested earlier: a table with 26 fields, one row for each question (50 rows). This is a flexible design, because it's easy to update the table if you need to change the weight factors, perhaps for a new questionnaire. To simplify the algorithms, you can make the weight fields SIGNED integers so that you can use -6 through +6 and avoid all the conversions. Then you can simply accumulate the total plus and minus weights for each personality type and multiply by 2 (100 / 50) to convert to percentages. If there's an issue of unanswered questions, you'll have to work that out, but that involves contextual decisions about what it means to skip questions, in terms of results.

If you need help with the PHP code, with respect to arrays etc., you can ask those separately, probably starting a new thread with your specific area of concern in the Subject.

Re: Scoring a Quiz

Posted: Sun Jul 06, 2008 5:20 pm
by Eran
If I may throw my 2 cents in:
I believe that while counting you need to normalize the answers back to a -6 to 6 scale (this however begs the question why did you move them from this scale in the first place). You could then sum them up directly and the highest ranking personality is the most compatible. What is the problem with choosing a 0 value in a question?

Re: Scoring a Quiz

Posted: Wed Jul 09, 2008 5:59 am
by cesarcesar
thanks for the advice posted.

califdon -
i have all ready built out the site and spend loads of time doing it so redoing databases and scripts is not something I want to do. I have all the data saved into a db as the user takes the test so all i have to do is calculate at the end of the quiz. My question is, what is the calculation that will give me the most accurate percentage based result.

pytrin -
i have the values set 1-13 and not -6 - 6 because this seemed a lot easier than working with negative numbers. Seems to me they are both the same no matter how they are written.