### Question:
BivariateDataStatisticsCalculator { public double meanSquaredError() { DoubleTensor calculatedY = xData.times(estimatedGradient()).plusInPlace(estimatedIntercept()); DoubleTensor residuals = yData.minus(calculatedY); long unbiasedMultiplier = size() - 2; return residuals.times(residuals).sumNumber() / unbiasedMultiplier; } BivariateDataStatisticsCalculator(DoubleTensor xData, DoubleTensor yData); long size(); double xMean(); double yMean(); double estimatedGradient(); double estimatedIntercept(); double meanSquaredError(); double standardErrorForGradient(); double standardErrorForIntercept();  }### Answer:
@Test public void youCanCalculateTheMeanSquaredError() { assertThat(stats.meanSquaredError(), greaterThan(0.)); }
@Test public void theMeanSquaredErrorIsZeroWhenTheDataIsPerfectlyCorrelated() { BivariateDataStatisticsCalculator perfectStats = new BivariateDataStatisticsCalculator(X_DATA, X_DATA.times(2.).plus(42.)); assertThat(perfectStats.meanSquaredError(), equalTo(0.)); }