Hello All, Before I chum the water with more JIRA tickets, I thought I would see whether people thought this was important.
In the SimpleRegression you have two methods: public void addData(double x, double y) { ...some code that is not germane to discussion...... if (n > 2) { distribution = new TDistributionImpl(n - 2); } } public void removeData(double x, double y) { ...some code that is not germane...... if (n > 2) { distribution = new TDistributionImpl(n - 2); } } } >From the perspective of a user, you are likely to call add/remove repeatedly before you ever need to check for statistical significance. Wouldn't it be better to instantiate the TDistribution when it is needed? So you would have to make the following two methods a bit more complicated: public double getSlopeConfidenceInterval(double alpha) throws MathException { if (alpha >= 1 || alpha <= 0) { throw new OutOfRangeException(LocalizedFormats.SIGNIFICANCE_LEVEL, alpha, 0, 1); } if( distribution == null || distribution.getDegreesOfFreedom() != n-2){ distribution = new TDistributionImpl(n - 2); } return getSlopeStdErr() * distribution.inverseCumulativeProbability(1d - alpha / 2d); } Similarly getSignificance() would have to be modified with the check of the degrees of freedom of the distribution. There is nothing wrong with the current code, but making the change means faster updates. Thoughts? -Greg