Package com.opengamma.analytics.math.statistics

Examples of com.opengamma.analytics.math.statistics.ConfidenceInterval


  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


  private static final LogNormalVolatilityEstimateConfidenceIntervalCalculator CALCULATOR = new LogNormalVolatilityEstimateConfidenceIntervalCalculator();
  private static final double EPS = 1e-4;

  @Test
  public void test() {
    final ConfidenceInterval intervals = CALCULATOR.getConfidenceInterval(0.2743, 0.95, 20);
    assertEquals(intervals.getLowerInterval(), 0.2086, EPS);
    assertEquals(intervals.getUpperInterval(), 0.4006, EPS);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.math.statistics.ConfidenceInterval

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.