@@ -0,0 +1,3007 @@
+/**%0A * %0A */%0Apackage edu.berkeley.cs.amplab.awesomedb.test;%0A%0Aimport java.io.FileWriter;%0Aimport java.io.IOException;%0A%0Aimport org.apache.commons.math.MathException;%0Aimport org.apache.commons.math.distribution.AbstractContinuousDistribution;%0Aimport org.apache.commons.math.distribution.NormalDistributionImpl;%0Aimport org.apache.commons.math.random.MersenneTwister;%0Aimport org.apache.commons.math.stat.descriptive.moment.Mean;%0Aimport org.apache.commons.math.stat.descriptive.moment.StandardDeviation;%0Aimport org.apache.commons.math.util.FastMath;%0A%0A%0Aimport edu.berkeley.cs.amplab.awesomedb.BlbMean;%0Aimport edu.berkeley.cs.amplab.awesomedb.BootstrapMean;%0Aimport edu.berkeley.cs.amplab.awesomedb.StatisticalMean;%0A%0Apublic class BlbTest %7B%0A    %0A    static double%5B%5D GenerateNormalSample(int sampleSize) throws MathException %7B%0A        MersenneTwister rng = new MersenneTwister();%0A        double mean = rng.nextDouble() * 100;%0A        double stdev = rng.nextDouble() * 1000;%0A        NormalDistributionImpl normalDistribution = new NormalDistributionImpl(%0A                mean, stdev);%0A        AbstractContinuousDistribution distribution = normalDistribution;%0A        return distribution.sample(sampleSize);%0A    %7D%0A    public static void main(String%5B%5D args) throws MathException, IOException %7B%0A        final long TESTS = 500;%0A        final int SMOOTHING = 1000;%0A        final int SampleSize = 10000;%0A        double%5B%5D samples = GenerateNormalSample(SampleSize);%0A        double closedFormError = StatisticalMean.StandardError(samples);%0A        System.out.println(%22Start computing bootstraps%22);%0A        BlbMean bootstraps%5B%5D = new BlbMean%5BSMOOTHING%5D;%0A        for(int i = 0; i %3C bootstraps.length; i++) %7B%0A            bootstraps%5Bi%5D = new BlbMean(samples, 1000,(int)(TESTS / 10));%0A            System.out.println(%22Computed BLB mean%22);%0A        %7D%0A        System.out.println(%22Done computing bootstraps%22);%0A        FileWriter file = new FileWriter(String.format(%22blbmean.dat%22));%0A        file.write(%22bootstraps,time,original,computed,difference%5Cn%22);%0A        for(int i = 2; i %3C TESTS * 100; i+=100) %7B%0A            Mean meanDeviation = new Mean();%0A            Mean meanTime = new Mean();%0A            for (int j = 0; j %3C bootstraps.length; j++) %7B%0A                StandardDeviation stdev = new StandardDeviation();%0A                double deviation = stdev.evaluate(bootstraps%5Bj%5D.getMeans(), 0, i);%0A                meanDeviation.increment(deviation);%0A                meanTime.increment(bootstraps%5Bj%5D.getTimes()%5Bi%5D);%0A            %7D%0A            double normalizedDifference = FastMath.abs(meanDeviation.getResult() - closedFormError) %0A                    / closedFormError;%0A            file.write(String.format(%22%251$s,%252$s,%253$s,%254$s,%255$s%5Cn%22,%0A                    i,%0A                    meanTime.getResult(),%0A                    closedFormError,%0A                    meanDeviation.getResult(),%0A                    normalizedDifference));%0A            file.flush();%0A            System.out.println(String.format(%22Done with %251$s%22, i));%0A        %7D%0A    %7D%0A%0A%7D%0A

Add test for BLB (though not sure if the times are representative)