SimpleRegression implements Serializable, UpdatingMultipleLinearRegression { public void append(SimpleRegression reg) { if (n == 0) { xbar = reg.xbar; ybar = reg.ybar; sumXX = reg.sumXX; sumYY = reg.sumYY; sumXY = reg.sumXY; } else { if (hasIntercept) { final double fact1 = reg.n / (double) (reg.n + n); final double fact2 = n * reg.n / (double) (reg.n + n); final double dx = reg.xbar - xbar; final double dy = reg.ybar - ybar; sumXX += reg.sumXX + dx * dx * fact2; sumYY += reg.sumYY + dy * dy * fact2; sumXY += reg.sumXY + dx * dy * fact2; xbar += dx * fact1; ybar += dy * fact1; }else{ sumXX += reg.sumXX; sumYY += reg.sumYY; sumXY += reg.sumXY; } } sumX += reg.sumX; sumY += reg.sumY; n += reg.n; } SimpleRegression();  SimpleRegression(boolean includeIntercept); void addData(final double x,final double y); void append(SimpleRegression reg); void removeData(final double x,final double y); void addData(final double[][] data); void addObservation(final double[] x,final double y); void addObservations(final double[][] x,final double[] y); void removeData(double[][] data); void clear(); long getN(); double predict(final double x); double getIntercept(); boolean hasIntercept(); double getSlope(); double getSumSquaredErrors(); double getTotalSumSquares(); double getXSumSquares(); double getSumOfCrossProducts(); double getRegressionSumSquares(); double getMeanSquareError(); double getR(); double getRSquare(); double getInterceptStdErr(); double getSlopeStdErr(); double getSlopeConfidenceInterval(); double getSlopeConfidenceInterval(final double alpha); double getSignificance(); RegressionResults regress(); RegressionResults regress(int[] variablesToInclude);  }
@Test public void testAppend() { check(false); check(true); }