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;
}

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 ; }
used for calculating top part of simple regression for beta 1
