Package de.torstennahm.statistics

Examples of de.torstennahm.statistics.Statistics


  @Override
  public IntegrationResult integrate(Function function, StopCondition condition, List<Visualizer> visualizers) {
    int dimension = function.inputDimension();
    double[] x = new double[dimension];
    final Statistics statistics = new Statistics();
   
    IntegrationResult result = new IntegrationResult() {
      public double value() {
        return statistics.average();
      }
 
      public double errorEstimate() {
        if (statistics.n() >= MIN_EVALUATIONS) {
          return (statistics.sigma() / Math.sqrt(statistics.n() - 1)) *
               T_INTERVAL * SAFETY_FACTOR;
        } else {
          return Double.NaN;
        }
      }
 
      public long functionCalls() {
        return (long)statistics.n();
      }
     
      public Set<IntegrationInfo> supplementalInfo() {
        return new HashSet<IntegrationInfo>();
      }
    };
   
    Visualizers.submitToList(visualizers, new Integrand(function));
    Visualizers.submitToList(visualizers, new StartIntegration());
   
    int count = 0;
    while (! condition.stop(result)) {
      for (int j = 0; j < dimension; j++) {
        x[j] = random.nextDouble();
      }
     
      statistics.add(function.sEvaluate(x));
     
      if (++count == 100) {
        Visualizers.submitToList(visualizers, new NewResult(result));
        count = 0;
      }
View Full Code Here


        String s = null, t = null, u = null;
        long firstPoints = entry.points;
       
        double qMax = 0.0;
        double var = 0;
        Statistics qStat = new Statistics();
        iter = log.iterator();
        iter.next();
        double n = Math.log(lastPoints / firstPoints);
        int entryNum = 0;
        while (entryNum < entries) {
          entry = iter.next();
         
          double d = Math.max(Math.abs(entry.minValue - lastResult), Math.abs(entry.maxValue - lastResult));
          var = Math.max(var, d);
          double m = Math.log(lastPoints / entry.points);
          double qEst = Double.NaN;
          if (var / totalVar < 0.5) {
            qEst = findQ(m , n, var / totalVar);
            if (! Double.isNaN(qEst)) {
              qStat.add(qEst);
              qMax = Math.max(qMax, qEst);
            }
          }
          if (s == null) {
            s = t = u = "[";
          } else {
            s += ", "; t += ", "; u += ", ";
          }
          s += Math.log(entry.points);
          t += qEst;
          u += Math.log(var);
          entryNum++;
        }
       
        double q = (qStat.average() + qStat.sigma() / Math.sqrt(qStat.n() - 1));
        if (0 < q && q < 1) {
          qB = new double[2];
          qB[0] = q;
          qB[1] = totalVar / (Math.pow(q, -n) - 1);
        }
View Full Code Here

TOP

Related Classes of de.torstennahm.statistics.Statistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.