Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Quiz statistics calculations

From MoodleDocs

General issues

Quizzes that allow multiple attempts

For quizzes that allow multiple attempts, by default the report should only include data from the first attempt by each student. Subsequent attempts probably do not satisfy the assumptions that underlie item analysis. However, there should be an option 'Include data from all attempts', which should have a disclaimer that this may be statistically invalid either near it on screen, or possibly in the help file. (For small data sets, it may be better to include all data.)

Using the first attempt also avoids problems caused by each attempt builds on last.

Within the analysis, when multiple attempts per student are included, each attempt is treadted as an independant attempt.

Adaptive mode

Adaptive mode does not pose a problem. We just assume that each item in the test returns a score, and these scores are added up to get the test score. That is, we use the item score including penalties in the calculation of the statistics.

Certainty based marking

Similarly, should CBM, and/or negative scoring for multiple choice questions be implemented, we just use the final item score in the calculations, making sure that the formulae are not assuming that the minimum item score is zero.

Incomplete attempts

There is an issue about what you do when not all students have answered all questions. Depending on how you handle these missing items, you distort the statistics in different ways.

There are basically two reasons why a student may not have answered a particular question:

  • they may have chosen to omit it, or
  • they may have run out of time, if the test is timed. In this case, omitted questions tend to be towards the end of the test.

Available approaches for handling this are:

  1. treat omitted items as having a score of 0.
  2. exclude any attempt with missing scores from the analysis.
  3. Analyse each question separately - and when analysing a particular question, just include students who answered that question in the analysis.

I think we should implement 1 for now. This is how Moodle currently works - a blank answer is marked and receives a score of zero, and so is indistinguishable from a wrong answer. Item analysis is most important for summative tests, and the result of that question being in the test is that it gave that student a contribution of 0 marks towards their final score.

Random questions

In a quiz with random questions not all students will have attempted the same set of questions. We need to decide what to do about that too. This is related to the previous section.

At the moment, Moodle does manage to distinguish which actual question the student answered which questions, and analyses each question separately, as in option 3 in the previous section. This is quite nice, but relies on the very computationally expensive way the report currently operates - it would be impossible to improve this using more SQL and less PHP.

(Need to decide what to do here).

Notation used in the calculations

(The only way I can think of to do this is to type TeX notation like $$x_i$$ even though MoodleDocs does not currently render it nicely. Maybe it will one day. In the mean time, if you want to see things nicely formatted, you will have to copy them to a Moodle with a working TeX filter.)

We have a lot of students $$s \in S$$, and a test comprising a number of items (questions) $$i \in I_s$$.

Each item has a maximum and minimum possible score within the test, $$x_i(min)$$ and $$x_i(max)$$. At the moment in Moodle, $$x_i(min)$$ is always zero, but we cannot assume that will continue to be the case. $$x_i(max)$$ is database column quiz_question_instances.grade.

Then, each student achieved an actual score $$x_i(s)$$ on each item. So $$x_i(min) \le x_i(s) \le x_i(max)$$.

$$x_i(s)$$ should be measured on the same scale as the final score for the quiz. That is, scaled by quiz_question_instances.grade, but that is already how grades are stored in mdl_question_states.

Each student has a total score

$$T_s = max(\sum_{i \in I} $$x_i(s)$$, 0).

Similarly, there are the maximum and minimum possible test scores

$$T_max$$ = \sum_{i \in I} $$x_i(max)$$

and

$$T_min = 0$$


Item statistics

Test statistics

Detailed item information