Commit 74686047 authored by jamiesensei's avatar jamiesensei
Browse files

MDL-17188 "effective question weight equation cannot cope with negative...

MDL-17188 "effective question weight equation cannot cope with negative covariance of question grades" excluding such questions from equation
parent af30cd88
<h1>Negative covariance of grade for this question with total quiz attempt grade</h1>
<p>This question's grade for this set of attempts on the quiz varies in an opposite way to the overall attempt grade. This means overall attempt grade tends to be below average when the grade for this question is above average and vice-versa.</p>
<p>Our equation for effective question weight cannot be calculated in this case. The calculations for effective question weight for other questions in this quiz are the effective question weight for these questions if the highlighted questions with a negative covariance are given a maximum grade of zero.</p>
<p>If you edit a quiz and give these question(s) with negative covariance a max grade of zero then the effective question weight of these questions will be zero and the real effective question weight of other questions will be as calculated now.</p>
\ No newline at end of file
......@@ -65,5 +65,5 @@ $string['frequency'] = 'Frequency';
$string['backtoquizreport'] = 'Back to main statistics report page.';
$string['analysisofresponsesfor'] = 'Analysis of responses for $a.';
$string['downloadeverything'] = 'Download full report as';
$string['negcovar'] ='Negative covariance of grade with total attempt grade';
?>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/quiz/report/statistics/db" VERSION="20080908" COMMENT="XMLDB file for Moodle mod/quiz/report/statistics"
<XMLDB PATH="mod/quiz/report/statistics/db" VERSION="20081110" COMMENT="XMLDB file for Moodle mod/quiz/report/statistics"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../lib/xmldb/xmldb.xsd"
>
......@@ -34,8 +34,9 @@
<FIELD NAME="questionid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="quizstatisticsid" NEXT="subquestion"/>
<FIELD NAME="subquestion" TYPE="int" LENGTH="4" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="questionid" NEXT="s"/>
<FIELD NAME="s" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="subquestion" NEXT="effectiveweight"/>
<FIELD NAME="effectiveweight" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="s" NEXT="discriminationindex"/>
<FIELD NAME="discriminationindex" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="effectiveweight" NEXT="discriminativeefficiency"/>
<FIELD NAME="effectiveweight" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="s" NEXT="negcovar"/>
<FIELD NAME="negcovar" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="effectiveweight" NEXT="discriminationindex"/>
<FIELD NAME="discriminationindex" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="negcovar" NEXT="discriminativeefficiency"/>
<FIELD NAME="discriminativeefficiency" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="false" SEQUENCE="false" ENUM="false" DECIMALS="5" PREVIOUS="discriminationindex" NEXT="sd"/>
<FIELD NAME="sd" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" DECIMALS="10" PREVIOUS="discriminativeefficiency" NEXT="facility"/>
<FIELD NAME="facility" TYPE="number" LENGTH="15" NOTNULL="false" UNSIGNED="true" SEQUENCE="false" ENUM="false" DECIMALS="10" PREVIOUS="sd" NEXT="subquestions"/>
......
......@@ -117,6 +117,23 @@ function xmldb_quizreport_statistics_upgrade($oldversion) {
}
}
}
if ($result && $oldversion < 2008111000) {
//delete all cached results first
$result = $result && $DB->delete_records('quiz_statistics');
$result = $result && $DB->delete_records('quiz_question_statistics');
$result = $result && $DB->delete_records('quiz_question_response_stats');
if ($result){
/// Define field anssubqid to be dropped from quiz_question_response_stats
$table = new xmldb_table('quiz_question_statistics');
/// Define field subqid to be added to quiz_question_response_stats
$field = new xmldb_field('negcovar', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'effectiveweight');
/// Conditionally launch add field subqid
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
}
}
return $result;
}
......
......@@ -249,15 +249,24 @@ class qstats{
foreach (array_keys($this->questions) as $qid){
$this->_secondary_question_walker($this->questions[$qid]->_stats);
$this->sumofgradevariance += $this->questions[$qid]->_stats->gradevariance;
$sumofcovariancewithoverallgrade += sqrt($this->questions[$qid]->_stats->covariancewithoverallgrade);
if ($this->questions[$qid]->_stats->covariancewithoverallgrade >= 0){
$sumofcovariancewithoverallgrade += sqrt($this->questions[$qid]->_stats->covariancewithoverallgrade);
$this->questions[$qid]->_stats->negcovar = 0;
} else {
$this->questions[$qid]->_stats->negcovar = 1;
}
}
foreach (array_keys($this->subquestions) as $qid){
$this->_secondary_question_walker($this->subquestions[$qid]->_stats);
}
foreach (array_keys($this->questions) as $qid){
if ($sumofcovariancewithoverallgrade){
$this->questions[$qid]->_stats->effectiveweight = 100 * sqrt($this->questions[$qid]->_stats->covariancewithoverallgrade)
/ $sumofcovariancewithoverallgrade;
if ($this->questions[$qid]->_stats->negcovar){
$this->questions[$qid]->_stats->effectiveweight = null;
} else {
$this->questions[$qid]->_stats->effectiveweight = 100 * sqrt($this->questions[$qid]->_stats->covariancewithoverallgrade)
/ $sumofcovariancewithoverallgrade;
}
} else {
$this->questions[$qid]->_stats->effectiveweight = null;
}
......
......@@ -142,7 +142,17 @@ class quiz_report_statistics_table extends flexible_table {
}
function col_effective_weight($question){
if (!$question->_stats->subquestion){
return number_format($question->_stats->effectiveweight, 2).'%';
if ($question->_stats->negcovar){
$negcovar = get_string('negcovar', 'quiz_statistics');
if (!$this->is_downloading()){
$negcovar .= helpbutton('negcovar', $negcovar, 'quiz_statistics', true, false, '', true);
return '<div class="negcovar">'.$negcovar.'</div>';
} else {
return $negcovar;
}
} else {
return number_format($question->_stats->effectiveweight, 2).'%';
}
} else {
return '';
}
......
<?php
$plugin->version = 2008090500; // The (date) version of this module
$plugin->version = 2008111000; // The (date) version of this module
?>
\ No newline at end of file
......@@ -1088,6 +1088,9 @@ table.quizreviewsummary td.cell {
border :medium solid yellow;
background-color:lightYellow;
}
#mod-quiz-report .negcovar{
border :medium solid pink;
}
/***
*** Modules: Resource
***/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment