I have a set of benchmark data for which I compute summary statistics using Apache Math Commons. Now I want to use the package to compute confidence intervals for the arithmetic means of e.g. running time measurements.
Is this possible at all? I am convinced that the package supports this, however I am at a loss about where to start.
This is the solution I ended up using with the help of Brent Worden's suggestion:
private double getConfidenceIntervalWidth(StatisticalSummary statistics, double significance) {
TDistribution tDist = new TDistribution(statistics.getN() - 1);
double a = tDist.inverseCumulativeProbability(1.0 - significance / 2);
return a * statistics.getStandardDeviation() / Math.sqrt(statistics.getN());
}
Apache Commons Math does not have direct support for constructing confidence intervals. However, it does have everything needed to compute them.
First, use SummaryStatistics, or some other StatisticalSummary implementation to summarize your data into sample statistics.
Next, use TDistribution to compute critical values for your desired confidence level. The degrees of freedom can be inferred from the summary statistics'
n
property.Last, use the
mean
,variance
, andn
property values from the summary statistics and the t critical value from the distribution to compute your lower and upper confidence limits.If you still want to calculate binomial in java by using only standard edition You can use below class like below.