code: public final double pearsonsCorrelationCoefficient() {
      checkState(count() > 1);
      if (isNaN(sumOfProductsOfDeltas)) {
        return NaN;
      }
      double xSumOfSquaresOfDeltas = xStats.sumOfSquaresOfDeltas();
      double ySumOfSquaresOfDeltas = yStats.sumOfSquaresOfDeltas();
      checkState(xSumOfSquaresOfDeltas > 0.0);
      checkState(ySumOfSquaresOfDeltas > 0.0);
      // The product of two positive numbers can be zero if the multiplication underflowed. We
      // force a positive value by effectively rounding up to MIN_VALUE.
      double productOfSumsOfSquaresOfDeltas =
          ensurePositive(xSumOfSquaresOfDeltas * ySumOfSquaresOfDeltas);
      return ensureInUnitRange(sumOfProductsOfDeltas / Math.sqrt(productOfSumsOfSquaresOfDeltas));
    }
docs: Returns the <a href="http://mathworld.wolfram.com/CorrelationCoefficient.html">Pearson's or
  product-moment correlation coefficient</a> of the values. The count must greater than one, and
  the {@code x} and {@code y} values must both have non-zero population variance (i.e. {@code
  xStats().populationVariance() > 0.0 && yStats().populationVariance() > 0.0}). The result is not
  guaranteed to be exactly +/-1 even when the data are perfectly (anti-)correlated, due to
  numerical errors. However, it is guaranteed to be in the inclusive range [-1, +1].
  
  <h3>Non-finite values</h3>
  
  <p>If the dataset contains any non-finite values ({@link Double#POSITIVE_INFINITY}, {@link
  Double#NEGATIVE_INFINITY}, or {@link Double#NaN}) then the result is {@link Double#NaN}.
  
  @throws IllegalStateException if the dataset is empty or contains a single pair of values, or
  either the {@code x} and {@code y} dataset has zero population variance