original_string: protected function sum_of_powers_of_difference_to_mean($mean, $fromqa, $whereqa, $qaparams) {
          global $DB;
  
          $sql = "SELECT
                      SUM(POWER((quiza.sumgrades - $mean), 2)) AS power2,
                      SUM(POWER((quiza.sumgrades - $mean), 3)) AS power3,
                      SUM(POWER((quiza.sumgrades - $mean), 4)) AS power4
                    FROM $fromqa
                   WHERE $whereqa";
          $params = array('mean1' => $mean, 'mean2' => $mean, 'mean3' => $mean) + $qaparams;
  
          return $DB->get_record_sql($sql, $params, MUST_EXIST);
      }
code: protected function sum_of_powers_of_difference_to_mean($mean, $fromqa, $whereqa, $qaparams) {
          global $DB;
  
          $sql = "SELECT
                      SUM(POWER((quiza.sumgrades - $mean), 2)) AS power2,
                      SUM(POWER((quiza.sumgrades - $mean), 3)) AS power3,
                      SUM(POWER((quiza.sumgrades - $mean), 4)) AS power4
                    FROM $fromqa
                   WHERE $whereqa";
          $params = array('mean1' => $mean, 'mean2' => $mean, 'mean3' => $mean) + $qaparams;
  
          return $DB->get_record_sql($sql, $params, MUST_EXIST);
      }
code_tokens: protected function sum_of_powers_of_difference_to_mean ( $ mean , $ fromqa , $ whereqa , $ qaparams ) { global $ DB ; $ sql = "SELECT
                      SUM(POWER((quiza.sumgrades - $mean), 2)) AS power2,
                      SUM(POWER((quiza.sumgrades - $mean), 3)) AS power3,
                      SUM(POWER((quiza.sumgrades - $mean), 4)) AS power4
                    FROM $fromqa
                   WHERE $whereqa" ; $ params = array ( 'mean1' => $ mean , 'mean2' => $ mean , 'mean3' => $ mean ) + $ qaparams ; return $ DB -> get_record_sql ( $ sql , $ params , MUST_EXIST ) ; }
docstring: Fetch the sum of squared, cubed and to the power 4 differences between sumgrade and it's mean.
  
  Explanation here : http://docs.moodle.org/dev/Quiz_item_analysis_calculations_in_practise
  #Calculating_Standard_Deviation.2C_Skewness_and_Kurtosis_of_grades_for_all_attempts_by_students
  
  @param $mean
  @param $fromqa
  @param $whereqa
  @param $qaparams
  @return object with properties power2, power3, power4
docstring_tokens: Fetch the sum of squared cubed and to the power 4 differences between sumgrade and it s mean .