Package com.opengamma.analytics.math.statistics.distribution

Examples of com.opengamma.analytics.math.statistics.distribution.ChiSquareDistribution


  @Override
  public ProbabilityDistribution<Double> evaluate(final double[] x) {
    Validate.notNull(x, "x");
    ArgumentChecker.notEmpty(x, "x");
    return new ChiSquareDistribution(_first.evaluate(x));
  }
View Full Code Here


    }
    if (maxLag < 0) {
      s_logger.warn("Maximum lag was less than zero; using absolute value");
    }
    _h = Math.abs(maxLag);
    _criticalValue = new ChiSquareDistribution(_h).getInverseCDF(1 - level);
  }
View Full Code Here

    }
    if (maxLag < 0) {
      s_logger.warn("Maximum lag was less than zero; using absolute value");
    }
    _h = Math.abs(maxLag);
    _criticalValue = new ChiSquareDistribution(_h).getInverseCDF(1 - level);
  }
View Full Code Here

  public JarqueBeraIIDHypothesis(final double level) {
    if (!ArgumentChecker.isInRangeExcludingLow(0, 1, level)) {
      throw new IllegalArgumentException("Level must be between 0 and 1");
    }
    _criticalValue = new ChiSquareDistribution(2).getInverseCDF(1 - level);
  }
View Full Code Here

    }
    if (maxLag < 0) {
      s_logger.info("Lag was negative; using absolute value");
    }
    _h = Math.abs(maxLag);
    _criticalValue = new ChiSquareDistribution(_h).getInverseCDF(1 - level);
  }
View Full Code Here

   * @param confidenceLevel The confidence level for the interval
   * @param n Degrees of freedom
   * @return The confidence interval
   */
  public ConfidenceInterval getConfidenceInterval(final double volatility, final double confidenceLevel, final int n) {
    _chiSquare = new ChiSquareDistribution(n - 1);
    final double alpha = 1 - confidenceLevel;
    final double lower = volatility * Math.sqrt((n - 1) / _chiSquare.getInverseCDF(1 - alpha / 2));
    final double upper = volatility * Math.sqrt((n - 1) / _chiSquare.getInverseCDF(alpha / 2));
    return new ConfidenceInterval(volatility, lower, upper, confidenceLevel);
  }
View Full Code Here

  @Test
  public void test() {
    final int n = 500000;
    final double k = 1.34;
    final ProbabilityDistribution<Double> p1 = new ChiSquareDistribution(k, new MersenneTwister64(MersenneTwister.DEFAULT_SEED));
    final double[] x = new double[n];
    for (int i = 0; i < n; i++) {
      x[i] = p1.nextRandom();
    }
    final ChiSquareDistribution p2 = (ChiSquareDistribution) CALCULATOR.evaluate(x);
    assertEquals(p2.getDegreesOfFreedom(), k, 2.5e-2);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.math.statistics.distribution.ChiSquareDistribution

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.