# Difference between revisions of "Quiz statistics calculations"

Moodle 2.0

Quiz report enhancements

## Introduction

This page describes the calculations of these quiz and question statistics. You can find a succinct description of their meanings here Quiz report statistics. Also see the documentation for the Quiz statistics report itself.

## 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. (The data for subsequent attempts probably does not satisfy the assumptions that underlie item analysis statistics.) 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 treated as an independent attempt. (That is, we pretend each attempt was by a different student.)

Adaptive mode does not pose a problem. Item Analysis just supposes that each item in the test returns a score, and these scores are added up to get the test score. Therefore Item Analysis does not care about adaptive/non-adaptive mode. However, just to be clear, for an adaptive question, the score used in the calculation is the final score for the item, including penalties.

### 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. To account for this, the analysis below distinguishes between positions in the test, and test items.

## Notation used in the calculations

We have a lot of students ${\displaystyle s\in S}$, who have completed at least one attempt on the quiz.

The test has a number of positions ${\displaystyle p\in P}$.

The test is assembled from a number of items ${\displaystyle i\in I}$.

Because of random questions, different students may have recieved different items in different positions, so ${\displaystyle i(p,s)}$ is the item student ${\displaystyle s}$ received in position ${\displaystyle p}$.

Let ${\displaystyle I_{s}}$ be the set of items that student ${\displaystyle s}$ saw. Let ${\displaystyle S_{i}}$ be the set of students who attempted item ${\displaystyle i}$.

Each position has a maximum and minimum possible contribution to the test score, ${\displaystyle x_{p}(min)}$ and ${\displaystyle x_{p}(max)}$. At the moment in Moodle, ${\displaystyle x_{p}(min)}$ is always zero, but we cannot assume that will continue to be the case. ${\displaystyle x_{p}(max)}$ is database column quiz_question_instances.grade.

Then, each student achieved an actual score ${\displaystyle x_{p}(s)}$ on the item in position ${\displaystyle p}$. So ${\displaystyle x_{p}(min)\leq x_{p}(s)\leq x_{p}(max)}$.

${\displaystyle x_{p}(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.

We can also think of the student's score on a particular item ${\displaystyle x_{i}(s)}$. However, in this case, the score should be measured out of the Default question grade for this question. Also, there is a ${\displaystyle x_{i}(max)}$ ( = Default question grade) and ${\displaystyle x_{i}(min)}$ (currently, zero, but if we allow negative marking, that will change).

${\displaystyle x_{i(p,s)}(s)=x_{p}(s){\frac {x_{i}(max)}{x_{p}(max)}}}$.

Each student has a total score

${\displaystyle \displaystyle T_{s}=\sum _{p\in P}x_{p}(s)}$

Similarly, there are the maximum and minimum possible test scores

${\displaystyle \displaystyle T_{max}=\sum _{p\in P}x_{p}(max)}$

and

${\displaystyle \displaystyle T_{min}=\sum _{p\in P}x_{p}(min)}$

### Intermediate calculations

To simplify the form of the formulas below, we need some intermediate calculated quantities, derived from the ones above.

Student's rest of test score for a position: ${\displaystyle X_{p}(s)=T_{s}-x_{p}(s)}$.

For any quantity that depends on position (for example ${\displaystyle x_{p}}$ or ${\displaystyle X_{p}}$), it's average is denoted with an overbar, and is an average over all students, so

${\displaystyle \displaystyle {\bar {x}}_{p}={\frac {1}{S}}\sum _{s\in S}x_{p}(s)}$.

When a quantity is a property of an item, a bar denotes an average over all students who attempted that item, so

${\displaystyle \displaystyle {\bar {x}}_{i}={\frac {1}{S_{i}}}\sum _{s\in S_{i}}x_{i}(s)}$.

Similarly we have the variance of a quantity depending on position:

${\displaystyle \displaystyle V(x_{p})={\frac {1}{S-1}}\sum _{s\in S}(x_{p}(s)-{\bar {x}}_{p})^{2}}$

and for a quantity depending on items:

${\displaystyle \displaystyle V(x_{i})={\frac {1}{S_{i}-1}}\sum _{s\in S_{i}}(x_{i}(s)-{\bar {x}}_{i})^{2}}$.

Finally, we need co-variances of two quantites, for example:

${\displaystyle \displaystyle C(x_{p},X_{p})={\frac {1}{S-1}}\sum _{s\in S}(x_{p}(s)-{\bar {x}}_{p})(X_{p}(s)-{\bar {X}}_{p})}$

${\displaystyle \displaystyle C(x_{i},X_{i})={\frac {1}{S_{i}-1}}\sum _{s\in S_{i}}(x_{i}(s)-{\bar {x}}_{i})(X_{i}(s)-{\bar {X}}_{i})}$.

## Position statistics

### Facility index

This is the average score on the item, expressed as a percentage:

${\displaystyle \displaystyle F_{p}=100{\frac {{\bar {x}}_{p}-x_{p}(min)}{x_{p}(max)-x_{p}(min)}}}$.

The higher the facility index, the easier the question is (for this cohort of students).

### Standard deviation

Again expressed on a percentage scale:

${\displaystyle \displaystyle SD_{p}=100{\frac {\sqrt {V(x_{p})}}{x_{p}(max)-x_{p}(min)}}}$.

### Discrimination index

This is the product moment correlation coefficient between ${\displaystyle x_{p}}$ and ${\displaystyle X_{p}}$, expressed on a percentage scale. That is,

${\displaystyle \displaystyle D_{p}=100r(x_{p},X_{p})=100{\frac {C(x_{p},X_{p})}{\sqrt {V(x_{P})V(X_{p})}}}}$.

The idea is that for a good question (or at least a question that fits in with the other questions in the test), students who have scored highly on the other parts of the test should also have scored highly on this question, so the score for the question and the score for the test as a whole should be well correlated.

The weakness of this statistic is that, unless the facility index is 50%, it is impossible for the discrimination index to be 100%, or, to put it another way, if ${\displaystyle F_{p}}$ is close to 0% or 100%, ${\displaystyle D_{p}}$ will always be very small. That makes interpreting this statistic difficult.

### Discriminative efficiency

This gets around that weakness in the discrimination index by expressing ${\displaystyle C(x_{p},X_{p})}$ as a percentage of the maximum value it could have taken given the scores the students got on this question, and the test as a whole. That is:

${\displaystyle \displaystyle DE_{p}=100{\frac {C(x_{p},X_{p})}{C_{max}(x_{p},X_{p})}}}$

where ${\displaystyle C_{max}(x_{p},X_{p})}$ is defined as follows:

When you compute ${\displaystyle C(x_{p},X_{p})}$, you do the sum

${\displaystyle \displaystyle C(x_{p},X_{p})={\frac {1}{S-1}}\sum _{s\in S}(x_{p}(s)-{\bar {x}}_{p})(X_{p}(s)-{\bar {X}}_{p})}$

which involves a term for each student combining their question score and rest of test score. That is, you start with an array of ${\displaystyle x_{p}(s)}$ with an array of corresponding ${\displaystyle X_{p}(s)}$, one for each ${\displaystyle s}$. To compute ${\displaystyle C_{max}(x_{p},X_{p})}$, you just sort these two arrays before applying the above formula. That is, for the purpose of computing ${\displaystyle C_{max}}$, you pretend that the first student scored the lowest ${\displaystyle x_{p}}$ and the lowest ${\displaystyle X_{p}}$, the second student scored the second lowest ${\displaystyle x_{p}}$ and the second lowest ${\displaystyle X_{p}}$, and so on to the last student, who scored the highest ${\displaystyle x_{p}}$ and ${\displaystyle X_{p}}$.

### Intended question weight

How much this question was supposed to contribute to determining the overall test score.

${\displaystyle \displaystyle IQW_{p}=100{\frac {x_{p}(max)-x_{p}(min)}{T_{max}-T_{min}}}}$.

### Effective question weight

This is an estimate of what proportion of the variance in the students' test scores is due this question.

${\displaystyle \displaystyle EQW_{p}=100{\frac {\sqrt {C(x_{p},T)}}{\sum _{p\in P}{\sqrt {C(x_{p},T)}}}}}$.

## Item statistics

### Number of attempts

The number of students who got this question as part of a quiz attempt. This is just ${\displaystyle S_{i}}$.

### Random guess score

This is the score that the student would have got by guessing randomly. It depends on the question type. For types like shortanswer, it is 0 - or the score associated with answer '*', if there is one.

For multiple choice questions (including matching, truefalse, etc.) it is the average score over all the possible choices.

(There should probably be a method in the question type class to compute this.)

### Facility index

${\displaystyle \displaystyle F_{i}=100{\frac {{\bar {x}}_{i}-x_{i}(min)}{x_{i}(max)-x_{i}(min)}}}$.

### Standard deviation

${\displaystyle \displaystyle SD_{i}=100{\frac {\sqrt {V(x_{i})}}{x_{i}(max)-x_{i}(min)}}}$.

### Discrimination index

${\displaystyle \displaystyle D_{i}=100r(x_{i},T)=100{\frac {C(x_{i},T)}{\sqrt {V(x_{i})V(T)}}}}$.

(It is not possible to define ${\displaystyle X_{i}}$ because it is conceivable that the same item may have been chosen in different positions with different weights, so we substitute ${\displaystyle T}$ instead.)

### Discriminative efficiency

${\displaystyle \displaystyle DE_{i}=100{\frac {C(x_{i},T)}{C_{max}(x_{i},T)}}}$.

## Test statistics

### Number of Attempts

This is ${\displaystyle S}$.

Note that depending on the options, we may be counting one or all attempts per student.

### Mean Score

Test mean ${\displaystyle \displaystyle ={\bar {T}}={\frac {1}{S}}\sum _{s\in S}T_{s}}$

### Median Score

Sort all the ${\displaystyle T_{s}}$, and take the middle one if S is odd, or the average of the two middle ones if S is even.

### Standard Deviation

Test standard deviation ${\displaystyle \displaystyle =SD={\sqrt {V(t)}}={\sqrt {{\frac {1}{S-1}}\sum _{s\in S}(T_{s}-{\bar {T}})^{2}}}}$.

### Skewness and Kurtosis

Probably of limited interest, but included for completeness. Skewness is a measure of the asymmetry in a distribution. Kurtosis - imagine a normal distribution. Kurtosis tells you if your distribution has more of a bulge, but thinner tails, or vice-versa.

First calculate:

${\displaystyle \displaystyle m_{2}={\frac {1}{S}}\sum _{s\in S}(T_{s}-{\bar {T}})^{2}}$

${\displaystyle \displaystyle m_{3}={\frac {1}{S}}\sum _{s\in S}(T_{s}-{\bar {T}})^{3}}$

${\displaystyle \displaystyle m_{4}={\frac {1}{S}}\sum _{s\in S}(T_{s}-{\bar {T}})^{4}}$

Then compute

${\displaystyle \displaystyle k_{2}={\frac {S}{S-1}}m_{2}=V(T)}$

${\displaystyle \displaystyle k_{3}={\frac {S^{2}}{(S-1)(S-2)}}m_{3}}$

${\displaystyle \displaystyle k_{4}={\frac {S^{2}}{(S-1)(S-2)(S-3)}}\left((S+1)m_{4}-3(S-1)m_{2}^{2}\right)}$

Then

Skewness ${\displaystyle \displaystyle ={\frac {k_{3}}{k_{2}^{3/2}}}}$

Kurtosis ${\displaystyle \displaystyle ={\frac {k_{4}}{k_{2}^{2}}}}$

### Coefficient of Internal Consistency

This is on a percentage scale

${\displaystyle \displaystyle CIC=100{\frac {P}{P-1}}\left(1-{\frac {1}{V(T)}}\sum _{p\in P}V(x_{p})\right)}$

Also called Cronbach's alpha in the literature.

### Error Ratio

Also a percentage.

${\displaystyle \displaystyle ER=100{\sqrt {1-{\frac {CIC}{100}}}}}$

### Standard Error

${\displaystyle \displaystyle SE={\frac {ER}{100}}SD}$

These last three are to do with estimating how reliable the test scores are. If you take the view that the score the student got on the test on the day is a combination of their actual ability and a random error (how lucky they were on the day of the test), the the standard error is an estimate of the luck factor. So if SE ~= 10, and the student scored 60, then you can be quite confident that their actual ability is between 50 and 70.