code: public static double sumOfMeanDifferencesOnePoint(double[] vector) {
          double mean = sum(vector) / vector.length;
          double ret = 0;
          for (int i = 0; i < vector.length; i++) {
              double vec1Diff = Math.pow(vector[i] - mean, 2);
              ret += vec1Diff;
          }
          return ret;
      }
docs: Used for calculating top part of simple regression for
  beta 1
  @param vector the x coordinates
  @return the sum of mean differences for the input vectors