Examples of AutocorrelationFunctionCalculator


Examples of com.opengamma.analytics.financial.timeseries.analysis.AutocorrelationFunctionCalculator

  }

  @Test
  public void test() {
    final AutocovarianceFunctionCalculator autocovariance = new AutocovarianceFunctionCalculator();
    final AutocorrelationFunctionCalculator autocorrelation = new AutocorrelationFunctionCalculator();
    final double[] rhoAR = autocorrelation.evaluate(AR);
    final double[] rhoMA = autocorrelation.evaluate(MA);
    final double[] rhoARMAP0 = autocorrelation.evaluate(MODEL.getSeries(PHI, P, null, 0, DATES));
    final double[] rhoARMA0Q = autocorrelation.evaluate(MODEL.getSeries(null, 0, THETA, Q, DATES));
    final double eps = Math.sqrt(STD) + 0.01;
    for (int i = 0; i < 200; i++) {
      assertEquals(Math.abs(rhoARMAP0[i] - rhoAR[i]), 0., eps);
      assertEquals(Math.abs(rhoARMA0Q[i] - rhoMA[i]), 0., eps);
    }
    final double[] rhoARMA11 = autocorrelation.evaluate(ARMA11);
    final double[] gammaARMA11 = autocovariance.evaluate(ARMA11);
    assertEquals(PHI[1] - THETA[1] * STD * STD / gammaARMA11[0], rhoARMA11[1], eps);
  }
View Full Code Here

Examples of com.opengamma.analytics.financial.timeseries.analysis.AutocorrelationFunctionCalculator

  }

  @Test
  public void testACF() {
    final double eps = 1e-2;
    final double[] rho = new AutocorrelationFunctionCalculator().evaluate(MA);
    final double rho1 = PHI[1] / (1 - PHI[2]);
    assertEquals(rho[0], 1, 1e-16);
    assertEquals(rho[1], rho1, eps);
    assertEquals(rho[2], rho1 * PHI[1] + PHI[2], eps);
    final Double mean = new DoubleTimeSeriesStatisticsCalculator(new MeanCalculator()).evaluate(MA);
View Full Code Here

Examples of com.opengamma.analytics.financial.timeseries.analysis.AutocorrelationFunctionCalculator

  }

  @Test
  public void testACF() {
    final double eps = 1e-2;
    final double[] rho = new AutocorrelationFunctionCalculator().evaluate(MA);
    assertEquals(rho[0], 1, 1e-16);
    final double denom = 1 + THETA[1] * THETA[1] + THETA[2] * THETA[2];
    assertEquals(rho[1], (THETA[1] * THETA[2] + THETA[1]) / denom, eps);
    assertEquals(rho[2], THETA[2] / denom, eps);
    for (int i = 1; i <= 20; i++) {
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.