code: public static function COVAR($yValues, $xValues)
      {
          if (!self::checkTrendArrays($yValues, $xValues)) {
              return Functions::VALUE();
          }
          $yValueCount = count($yValues);
          $xValueCount = count($xValues);
  
          if (($yValueCount == 0) || ($yValueCount != $xValueCount)) {
              return Functions::NA();
          } elseif ($yValueCount == 1) {
              return Functions::DIV0();
          }
  
          $bestFitLinear = Trend::calculate(Trend::TREND_LINEAR, $yValues, $xValues);
  
          return $bestFitLinear->getCovariance();
      }
docs: COVAR.
  
  Returns covariance, the average of the products of deviations for each data point pair.
  
  @param mixed $yValues array of mixed Data Series Y
  @param mixed $xValues array of mixed Data Series X
  
  @return float