コード例 #1
0
  @Test
  public void testSolutionFlatSurface() {
    final LeastSquareResultsWithTransform results =
        FITTER.getFitResult(OPTIONS, FLAT_DATA, ERRORS, INITIAL_VALUES, FIXED);
    final DoubleMatrix1D parameters = results.getModelParameters();
    assertEquals("a", SIGMA * SIGMA, parameters.getEntry(0), EPS);
    assertEquals("b", 0.0, parameters.getEntry(1), EPS);
    // TODO investigate why a chi^2 of 0 is not reached
    // assertEquals("chi^2", 0.0, results.getChiSq(), EPS);

  }
コード例 #2
0
 @Test
 public void testRecoverParameters() {
   LeastSquareResultsWithTransform results =
       FITTER.getFitResult(OPTIONS, SMILE_DATA, INITIAL_VALUES, FIXED);
   DoubleMatrix1D fit = results.getModelParameters();
   final double eps = ERRORS[0];
   assertEquals("a", SVI_DATA.getA(), fit.getEntry(0), eps);
   assertEquals("b", SVI_DATA.getB(), fit.getEntry(1), eps);
   assertEquals("rho", SVI_DATA.getRho(), fit.getEntry(2), eps);
   assertEquals("sigma", SVI_DATA.getNu(), fit.getEntry(3), eps * 100);
   assertEquals("m", SVI_DATA.getM(), fit.getEntry(4), eps);
   final double chiSq = results.getChiSq();
   assertEquals("chi^2", 0, chiSq, eps * eps);
   results = FITTER.getFitResult(OPTIONS, SMILE_DATA, ERRORS, INITIAL_VALUES, FIXED);
   fit = results.getModelParameters();
   assertEquals(SVI_DATA.getA(), fit.getEntry(0), eps);
   assertEquals(SVI_DATA.getB(), fit.getEntry(1), eps);
   assertEquals(SVI_DATA.getRho(), fit.getEntry(2), eps);
   assertEquals(SVI_DATA.getNu(), fit.getEntry(3), eps * 100);
   assertEquals(SVI_DATA.getM(), fit.getEntry(4), eps);
   assertEquals(results.getChiSq() * eps * eps, chiSq, eps);
 }