Development:Quiz item analysis calculations in practice: Difference between revisions
Jamie Pratt (talk | contribs) |
m (Development:Quiz item analysis calculations in practise moved to Development:Quiz item analysis calculations in practice: Fix typo) |
||
(16 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Moodle 2.0}} | |||
{{Quiz item analysis calculations}} | |||
==Purpose of this page== | |||
Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-) | Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-) | ||
== | ==Code== | ||
The calculations below are all done in quiz/report/statistics/report.php The code refers to links to this doc in php comments. | |||
==Calculating MEAN of grades for all attempts by students== | ==Calculating MEAN of grades for all attempts by students== | ||
<math>\displaystyle = \bar{T} = \frac{1}{S} \sum_{s \in S} T_s</math> | |||
We calculate the MEAN of first and all attempts by : | We calculate the MEAN of first and all attempts by : | ||
Line 14: | Line 18: | ||
* fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts. | * fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts. | ||
* then to get the mean of first attempts : | * then to get the mean of first attempts : | ||
** we divide the total grade for all first attempts. | ** we divide the total grade for all first attempts by the number of all first attempts. | ||
* for the mean for all attempts : | * for the mean for all attempts : | ||
** we add the total of all first attempts to the total for the rest of the attempts | ** we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts. | ||
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade. | Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade. | ||
Line 28: | Line 32: | ||
We can get sql to do the following calculations : | We can get sql to do the following calculations : | ||
power2 | power2 <math>\displaystyle = \sum_{s \in S} (T_s - \bar{T})^2</math> | ||
power3 | power3 <math>\displaystyle = \sum_{s \in S} (T_s - \bar{T})^3</math> | ||
power4 | power4 <math>\displaystyle = \sum_{s \in S} (T_s - \bar{T})^4</math> | ||
===Standard Deviation=== | ===Standard Deviation=== | ||
Test standard deviation | Test standard deviation <math>\displaystyle = SD = \sqrt{V(t)} = \sqrt{\frac{1}{S - 1} \sum_{s \in S} (T_s - \bar{T})^2}</math> | ||
<math>= \sqrt{\frac{power2}{S-1}}</math> | |||
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade. | Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade. | ||
Line 46: | Line 50: | ||
So then : | So then : | ||
<math>\displaystyle m_2 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^2 = \frac{power2}{S}</math> | |||
<math>\displaystyle m_3 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^3 = \frac{power3}{S}</math> | |||
<math>\displaystyle m_4 = \frac{1}{S} \sum_{s \in S} (T_s - \bar{T})^4 = \frac{power4}{S}</math> | |||
<math>\displaystyle k_2 = \frac{S}{S - 1} m_2 = \frac{S m_2}{S - 1}</math> | |||
<math>\displaystyle k_3 = \frac{S^2}{(S - 1)(S - 2)} m_3 = \frac{S^2 m_3}{(S - 1)(S - 2)}</math> | |||
<math>\displaystyle k_4 = \frac{S^3}{(S - 1)(S - 2)(S - 3)} \left((S + 1)m_4 - 3(S - 1)m_2^2\right)</math> | |||
Then Skewness <math>\displaystyle = \frac{k_3}{k_2^{2/3}}</math> | |||
and : | |||
Kurtosis <math>\displaystyle = \frac{k_4}{k_2^2}</math> | |||
==CIC, ER and SE== | |||
First we fetch the average grade for each position : | |||
<math>\displaystyle \bar{x}_p = \frac{1}{S} \sum_{s \in S} x_p(s)</math>. | |||
Then : | |||
<math>\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{V(T)}\sum_{p \in P} V(x_p) \right)</math> | |||
and : | and : | ||
<math>\displaystyle V(T) = k_2 = \frac{S}{S - 1} m_2</math> | |||
and : | |||
<math>\displaystyle V(x_p) = \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2</math> | |||
So : | |||
<math>\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2}\sum_{p \in P} \frac{1}{S - 1} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)= 100 \frac{P}{P - 1} \left(1 - \frac{1}{k_2(S - 1)} \sum_{p \in P} \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right) </math> | |||
We fetch : | |||
<math>\displaystyle \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 </math> | |||
From the db for all questions and then sum them all so we have : | |||
<math>\displaystyle sum =\sum_{p \in P} \left( \sum_{s \in S} (x_p(s) - \bar{x}_p)^2 \right)</math> | |||
Then we do : | |||
<math>sumofvarianceforallpositions = sum/(S - 1)</math> | |||
Then : | |||
<math>\displaystyle CIC = 100 \frac{P}{P - 1} \left(1 - \frac{sumofvarianceforallpositions}{k_2} \right) </math> | |||
And : | |||
<math>\displaystyle ER = 100 \sqrt{1 - \frac{CIC}{100}}</math> | |||
And : | |||
<math>\displaystyle SE = \frac{ER}{100}SD</math> | |||
Since SE is a grade we divide it by the maximum possible grade and times by 100 to get a percentage of the max possible grade for the whole quiz. |
Latest revision as of 16:41, 5 December 2010
Template:Moodle 2.0 Template:Quiz item analysis calculations
Purpose of this page
Here I'm going to document what the code actually does. Documenting it here principally because I can't use TEX notation in php comments, well I guess I can but only real TEX geeks will be able to read it :-)
Code
The calculations below are all done in quiz/report/statistics/report.php The code refers to links to this doc in php comments.
Calculating MEAN of grades for all attempts by students
We calculate the MEAN of first and all attempts by :
- fetching two totals and counts of all grades for attempts from the db the total grades for first attempts and the rest of the attempts.
- then to get the mean of first attempts :
- we divide the total grade for all first attempts by the number of all first attempts.
- for the mean for all attempts :
- we add the total of all first attempts to the total for the rest of the attempts and divide by the total count of first attempts plus the total count of the rest of the attempts.
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.
Depending on whether we are calculating the rest of the statistics for all attempts or for just the first attempts we select the appropriate mean to use in the rest of the calculations and save a empty string or a string of sql that selects first attempts only.
Calculating Standard Deviation, Skewness and Kurtosis of grades for all attempts by students
In order not to have to load potentially large datasets into memory we get the DB to do the bulk of the work doing these calculations.
We can get sql to do the following calculations :
power2
power3
power4
Standard Deviation
Test standard deviation
Before display I divide by quiz.sumgrades and times by a hundred to express this as a percentage of total possible grade.
Skewness and Kurtosis
So then :
Then Skewness
and :
Kurtosis
CIC, ER and SE
First we fetch the average grade for each position :
.
Then :
and :
and :
So :
We fetch :
From the db for all questions and then sum them all so we have :
Then we do :
Then :
And :
And :
Since SE is a grade we divide it by the maximum possible grade and times by 100 to get a percentage of the max possible grade for the whole quiz.