*
* @param includeIntercept
*/
private void check(boolean includeIntercept) {
final int sets = 2;
final ISAACRandom rand = new ISAACRandom(10L);// Seed can be changed
final SimpleRegression whole = new SimpleRegression(includeIntercept);// regression of the whole set
final SimpleRegression parts = new SimpleRegression(includeIntercept);// regression with parts.
for (int s = 0; s < sets; s++) {// loop through each subset of data.
final double coef = rand.nextDouble();
final SimpleRegression sub = new SimpleRegression(includeIntercept);// sub regression
for (int i = 0; i < 5; i++) { // loop through individual samlpes.
final double x = rand.nextDouble();
final double y = x * coef + rand.nextDouble();// some noise
sub.addData(x, y);
whole.addData(x, y);
}
parts.append(sub);
Assert.assertTrue(equals(parts, whole, 1E-6));