private double rss(TetradMatrix x,TetradVector y,TetradVector b){
  double rss=0.0;
  for (int i=0; i < x.rows(); i++) {
    double yH=0.0;
    for (int j=0; j < x.columns(); j++) {
      yH+=b.get(j) * x.get(i,j);
    }
    double d=y.get(i) - yH;
    rss+=d * d;
  }
  return rss;
}

private double rss ( TetradMatrix x , TetradVector y , TetradVector b ) { double rss = 0.0 ; for ( int i = 0 ; i < x . rows ( ) ; i ++ ) { double yH = 0.0 ; for ( int j = 0 ; j < x . columns ( ) ; j ++ ) { yH += b . get ( j ) * x . get ( i , j ) ; } double d = y . get ( i ) - yH ; rss += d * d ; } return rss ; }
calculates the residual sum of squares for parameter data x , actual values y , and regression coefficients b - - i . e . , for each point in the data , the predicted value for that point is calculated , and then it is subtracted from the actual value . the sum of the squares of these difference values over all points in the data is calculated and returned .
