]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17188 "effective question weight equation cannot cope with negative covariance...
authorjamiesensei <jamiesensei>
Mon, 10 Nov 2008 11:56:37 +0000 (11:56 +0000)
committerjamiesensei <jamiesensei>
Mon, 10 Nov 2008 11:56:37 +0000 (11:56 +0000)
lang/en_utf8/help/quiz_statistics/negcovar.html [new file with mode: 0644]
lang/en_utf8/quiz_statistics.php
mod/quiz/report/statistics/db/install.xml
mod/quiz/report/statistics/db/upgrade.php
mod/quiz/report/statistics/qstats.php
mod/quiz/report/statistics/statistics_table.php
mod/quiz/report/statistics/version.php
theme/standard/styles_color.css

diff --git a/lang/en_utf8/help/quiz_statistics/negcovar.html b/lang/en_utf8/help/quiz_statistics/negcovar.html
new file mode 100644 (file)
index 0000000..5c6b584
--- /dev/null
@@ -0,0 +1,4 @@
+<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
index 1a6ff7d3569cd4810e3d2499dfcf999cd04bc8f7..d8de227c2b484e4126c647077ebcc2e4813ddb4a 100644 (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
index 08d69ea025195bf82efd4d28f511d265169d3904..6610052e6132680f827a816e1694bf2433b73f12 100644 (file)
@@ -1,5 +1,5 @@
 <?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"/>
index 4b65ff2c74f970a8e28dbf9da05a58a65d387092..a889be710c3981fddcbf2fec181dc4f47c5b3b00 100644 (file)
@@ -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;
 }
 
index 8d2dc0f08c5b4e256a5af8bc6bde47240c6de2ee..9a260d3673c0591d70a0e42f7c6eeb46ac1b3ac0 100644 (file)
@@ -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;
             }
index 694fd06d6e027c2206a5301dad124d6d4dade1f3..61596e08d544d6fd56322424a09635c06e89377b 100644 (file)
@@ -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 '';
         }
index e08b511b26d64089dfed1d8071d64007629c85f0..53af2cdaad1b03c0a5526fe164df4ca0cd0d2e5a 100644 (file)
@@ -1,4 +1,4 @@
 <?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
index bc39d38f7080ee352671eced6cdb45921c78433e..ff24cbd0e675f1132ab4177f991d595da0952b9c 100644 (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
  ***/