Package com.opengamma.analytics.math.statistics.descriptive

Examples of com.opengamma.analytics.math.statistics.descriptive.MeanCalculator.evaluate()


   * @param nu Computed by getShiftedDrift method
   * @return space step
   */
  public double getSpaceStep(final double timeToExpiry, final double[] volatility, final int nSteps, final double[] nu) {
    final Function1D<double[], Double> calculator = new MeanCalculator();
    final double meanNu = calculator.evaluate(nu);
    final double meanVol = calculator.evaluate(volatility);
    final double dt = timeToExpiry / nSteps;

    return Math.sqrt(meanVol * meanVol * dt + meanNu * meanNu * dt * dt);
  }
View Full Code Here


   * @return space step
   */
  public double getSpaceStep(final double timeToExpiry, final double[] volatility, final int nSteps, final double[] nu) {
    final Function1D<double[], Double> calculator = new MeanCalculator();
    final double meanNu = calculator.evaluate(nu);
    final double meanVol = calculator.evaluate(volatility);
    final double dt = timeToExpiry / nSteps;

    return Math.sqrt(meanVol * meanVol * dt + meanNu * meanNu * dt * dt);
  }

View Full Code Here

   * @param dt time step
   * @return space step
   */
  public double getSpaceStepTrinomial(final double[] volatility, final double[] nu, final double dt) {
    final Function1D<double[], Double> calculator = new MeanCalculator();
    final double meanNu = calculator.evaluate(nu);
    final double meanVol = calculator.evaluate(volatility);

    return Math.sqrt(3. * meanVol * meanVol * dt + meanNu * meanNu * dt * dt);
  }
}
View Full Code Here

   * @return space step
   */
  public double getSpaceStepTrinomial(final double[] volatility, final double[] nu, final double dt) {
    final Function1D<double[], Double> calculator = new MeanCalculator();
    final double meanNu = calculator.evaluate(nu);
    final double meanVol = calculator.evaluate(volatility);

    return Math.sqrt(3. * meanVol * meanVol * dt + meanNu * meanNu * dt * dt);
  }
}
View Full Code Here

    final int nData = xData.length;
    final double[] res = new double[nData];

    Function1D<double[], Double> calculator = new MeanCalculator();
    _renorm[0] = calculator.evaluate(xData);
    calculator = new SampleStandardDeviationCalculator();
    _renorm[1] = calculator.evaluate(xData);

    final double tmp = _renorm[0] / _renorm[1];
    for (int i = 0; i < nData; ++i) {
View Full Code Here

    final double[] res = new double[nData];

    Function1D<double[], Double> calculator = new MeanCalculator();
    _renorm[0] = calculator.evaluate(xData);
    calculator = new SampleStandardDeviationCalculator();
    _renorm[1] = calculator.evaluate(xData);

    final double tmp = _renorm[0] / _renorm[1];
    for (int i = 0; i < nData; ++i) {
      res[i] = xData[i] / _renorm[1] - tmp;
    }
View Full Code Here

      data[i] = DIST.nextRandom();
    }
    final double mean = MU + SIGMA / (1 - KSI);
    final double median = MU + SIGMA * (Math.pow(2, KSI) - 1) / KSI;
    final double variance = SIGMA * SIGMA / ((1 - KSI) * (1 - KSI) * (1 - 2 * KSI));
    assertEquals(meanCalculator.evaluate(data), mean, eps);
    assertEquals(medianCalculator.evaluate(data), median, eps);
    assertEquals(varianceCalculator.evaluate(data), variance, eps);
  }

  private void assertLimit(final ProbabilityDistribution<Double> dist, final double limit) {
View Full Code Here

    ArgumentChecker.notNull(underlyingPool, "Underlying pool");

    MeanCalculator mean = new MeanCalculator();

    return mean.evaluate(underlyingPool.getObligorNotionals());
  }

  // ----------------------------------------------------------------------------------------------------------------------------------------

  // Calculate the average recovery rate of the obligors in the underlying pool
View Full Code Here

    MeanCalculator mean = new MeanCalculator();

    double[] recoveryRates = underlyingPool.getRecoveryRates();

    return mean.evaluate(recoveryRates);
  }

  // ----------------------------------------------------------------------------------------------------------------------------------------

  // Get the minimum spread of the obligors in the underlying pool for the given tenor
View Full Code Here

    MeanCalculator mean = new MeanCalculator();

    double[] spreads = getSpreads(underlyingPool, creditSpreadTenors, creditSpreadTermStructures, creditSpreadTenor);

    return mean.evaluate(spreads);
  }

  // ----------------------------------------------------------------------------------------------------------------------------------------

  // Calculate the median spread of the obligors in the underlying pool for a given tenor
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.