original_string: protected function secondary_question_walker($stats) {
          if ($stats->s > 1) {
              $stats->markvariance = $stats->markvariancesum / ($stats->s - 1);
              $stats->othermarkvariance = $stats->othermarkvariancesum / ($stats->s - 1);
              $stats->covariance = $stats->covariancesum / ($stats->s - 1);
              $stats->covariancemax = $stats->covariancemaxsum / ($stats->s - 1);
              $stats->covariancewithoverallmark = $stats->covariancewithoverallmarksum /
                  ($stats->s - 1);
              $stats->sd = sqrt($stats->markvariancesum / ($stats->s - 1));
  
              if ($stats->covariancewithoverallmark >= 0) {
                  $stats->negcovar = 0;
              } else {
                  $stats->negcovar = 1;
              }
          } else {
              $stats->markvariance = null;
              $stats->othermarkvariance = null;
              $stats->covariance = null;
              $stats->covariancemax = null;
              $stats->covariancewithoverallmark = null;
              $stats->sd = null;
              $stats->negcovar = 0;
          }
  
          if ($stats->markvariance * $stats->othermarkvariance) {
              $stats->discriminationindex = 100 * $stats->covariance /
                  sqrt($stats->markvariance * $stats->othermarkvariance);
          } else {
              $stats->discriminationindex = null;
          }
  
          if ($stats->covariancemax) {
              $stats->discriminativeefficiency = 100 * $stats->covariance /
                  $stats->covariancemax;
          } else {
              $stats->discriminativeefficiency = null;
          }
  
          foreach ($stats->variantstats as $variantstat) {
              $this->secondary_question_walker($variantstat);
          }
      }
code: protected function secondary_question_walker($stats) {
          if ($stats->s > 1) {
              $stats->markvariance = $stats->markvariancesum / ($stats->s - 1);
              $stats->othermarkvariance = $stats->othermarkvariancesum / ($stats->s - 1);
              $stats->covariance = $stats->covariancesum / ($stats->s - 1);
              $stats->covariancemax = $stats->covariancemaxsum / ($stats->s - 1);
              $stats->covariancewithoverallmark = $stats->covariancewithoverallmarksum /
                  ($stats->s - 1);
              $stats->sd = sqrt($stats->markvariancesum / ($stats->s - 1));
  
              if ($stats->covariancewithoverallmark >= 0) {
                  $stats->negcovar = 0;
              } else {
                  $stats->negcovar = 1;
              }
          } else {
              $stats->markvariance = null;
              $stats->othermarkvariance = null;
              $stats->covariance = null;
              $stats->covariancemax = null;
              $stats->covariancewithoverallmark = null;
              $stats->sd = null;
              $stats->negcovar = 0;
          }
  
          if ($stats->markvariance * $stats->othermarkvariance) {
              $stats->discriminationindex = 100 * $stats->covariance /
                  sqrt($stats->markvariance * $stats->othermarkvariance);
          } else {
              $stats->discriminationindex = null;
          }
  
          if ($stats->covariancemax) {
              $stats->discriminativeefficiency = 100 * $stats->covariance /
                  $stats->covariancemax;
          } else {
              $stats->discriminativeefficiency = null;
          }
  
          foreach ($stats->variantstats as $variantstat) {
              $this->secondary_question_walker($variantstat);
          }
      }
code_tokens: protected function secondary_question_walker ( $ stats ) { if ( $ stats -> s > 1 ) { $ stats -> markvariance = $ stats -> markvariancesum / ( $ stats -> s - 1 ) ; $ stats -> othermarkvariance = $ stats -> othermarkvariancesum / ( $ stats -> s - 1 ) ; $ stats -> covariance = $ stats -> covariancesum / ( $ stats -> s - 1 ) ; $ stats -> covariancemax = $ stats -> covariancemaxsum / ( $ stats -> s - 1 ) ; $ stats -> covariancewithoverallmark = $ stats -> covariancewithoverallmarksum / ( $ stats -> s - 1 ) ; $ stats -> sd = sqrt ( $ stats -> markvariancesum / ( $ stats -> s - 1 ) ) ; if ( $ stats -> covariancewithoverallmark >= 0 ) { $ stats -> negcovar = 0 ; } else { $ stats -> negcovar = 1 ; } } else { $ stats -> markvariance = null ; $ stats -> othermarkvariance = null ; $ stats -> covariance = null ; $ stats -> covariancemax = null ; $ stats -> covariancewithoverallmark = null ; $ stats -> sd = null ; $ stats -> negcovar = 0 ; } if ( $ stats -> markvariance * $ stats -> othermarkvariance ) { $ stats -> discriminationindex = 100 * $ stats -> covariance / sqrt ( $ stats -> markvariance * $ stats -> othermarkvariance ) ; } else { $ stats -> discriminationindex = null ; } if ( $ stats -> covariancemax ) { $ stats -> discriminativeefficiency = 100 * $ stats -> covariance / $ stats -> covariancemax ; } else { $ stats -> discriminativeefficiency = null ; } foreach ( $ stats -> variantstats as $ variantstat ) { $ this -> secondary_question_walker ( $ variantstat ) ; } }
docstring: And finally loop through all the questions again.
  
  Perform more per-question statistics calculations.
  
  @param calculated $stats question stats to update.
docstring_tokens: And finally loop through all the questions again .