@Test public void testCalculateRegressionForAvgPrice() { Prediction[] predictions = calc.calculateRegressionForAvgPrice(histRunnerPrices, 1000 * 60, TimeUnit.SECONDS); assertEquals(predictions.length, histRunnerPrices.size()); for (Prediction prediction : predictions) { System.out.println("slope/err: " + prediction.getSlope() + "/" + prediction.getSlopeErr()); } assertEquals(Double.NaN, predictions[0].getSlope(), 0.001); assertEquals(0, predictions[1].getSlope(), 0.001); assertEquals(0, predictions[2].getSlope(), 0.001); assertEquals(4.246, predictions[3].getSlope(), 0.001); assertEquals(4.246, predictions[4].getSlope(), 0.001); assertEquals(5.634, predictions[5].getSlope(), 0.001); assertEquals(5.529, predictions[6].getSlope(), 0.001); assertEquals(3.863, predictions[7].getSlope(), 0.001); assertEquals(3.760, predictions[8].getSlope(), 0.001); assertEquals(3.502, predictions[9].getSlope(), 0.001); assertEquals(3.832, predictions[10].getSlope(), 0.001); assertEquals(3.876, predictions[11].getSlope(), 0.001); assertEquals(3.775, predictions[12].getSlope(), 0.001); assertEquals(3.995, predictions[13].getSlope(), 0.001); assertEquals(4.039, predictions[14].getSlope(), 0.001); assertEquals(3.979, predictions[15].getSlope(), 0.001); }