MixedBivariateLogNormalCorrelationFinder { public void doFit(final double[] rhosGuess, final double[] dataStrikes, final double[] dataVolatilities, final double timeToExpiry, final double[] weights, final double[] sigmasX, final double[] sigmasY, final double[] relativePartialForwardsX, final double[] relativePartialForwardsY, final double forwardX, final double forwardY) { ArgumentChecker.notNull(rhosGuess, "rhosGuess"); ArgumentChecker.notNull(dataStrikes, "dataStrikes"); ArgumentChecker.notNull(dataVolatilities, "dataVolatilities"); ArgumentChecker.notNull(weights, "weights"); ArgumentChecker.notNull(sigmasX, "sigmasX"); ArgumentChecker.notNull(sigmasY, "sigmasY"); ArgumentChecker.notNull(relativePartialForwardsX, "relativePartialForwardsX"); ArgumentChecker.notNull(relativePartialForwardsY, "relativePartialForwardsY"); final int nNormals = rhosGuess.length; final int nData = dataStrikes.length; ArgumentChecker.isTrue(dataStrikes.length == dataVolatilities.length, "dataStrikes not the same length as dataVols"); ArgumentChecker.isTrue(weights.length == sigmasX.length, "weights not the same length as sigmasX"); ArgumentChecker.isTrue(weights.length == sigmasY.length, "weights not the same length as sigmasY"); ArgumentChecker.isTrue(weights.length == relativePartialForwardsX.length, "weights not the same length as relativePartialForwardsX"); ArgumentChecker.isTrue(weights.length == relativePartialForwardsY.length, "weights not the same length as relativePartialForwardsY"); for (int i = 0; i < nData; ++i) { ArgumentChecker.isFalse(Double.isNaN(dataStrikes[i]), "dataStrikes containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(dataStrikes[i]), "dataStrikes containing Infinity"); ArgumentChecker.isFalse(Double.isNaN(dataVolatilities[i]), "dataVolatilities containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(dataVolatilities[i]), "dataVolatilities containing Infinity"); } for (int i = 0; i < nNormals; ++i) { ArgumentChecker.isFalse(Double.isNaN(rhosGuess[i]), "rhosGuess containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(rhosGuess[i]), "rhosGuess containing Infinity"); ArgumentChecker.isFalse(Double.isNaN(weights[i]), "weights containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(weights[i]), "weights containing Infinity"); ArgumentChecker.isFalse(Double.isNaN(sigmasX[i]), "sigmasX containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(sigmasX[i]), "sigmasX containing Infinity"); ArgumentChecker.isFalse(Double.isNaN(sigmasY[i]), "sigmasY containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(sigmasY[i]), "sigmasY containing Infinity"); ArgumentChecker.isFalse(Double.isNaN(relativePartialForwardsX[i]), "relativePartialForwardsX containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(relativePartialForwardsX[i]), "relativePartialForwardsX containing Infinity"); ArgumentChecker.isFalse(Double.isNaN(relativePartialForwardsY[i]), "relativePartialForwardsY containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(relativePartialForwardsY[i]), "relativePartialForwardsY containing Infinity"); } ArgumentChecker.isFalse(Double.isNaN(timeToExpiry), "timeToExpiry containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(timeToExpiry), "timeToExpiry containing Infinity"); ArgumentChecker.isFalse(Double.isNaN(forwardX), "forwardX containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(forwardX), "forwardX containing Infinity"); ArgumentChecker.isFalse(Double.isNaN(forwardY), "forwardY containing NaN"); ArgumentChecker.isFalse(Double.isInfinite(forwardY), "forwardY containing Infinity"); ArgumentChecker.isTrue(timeToExpiry > 0, "timeToExpiry should be positive"); ArgumentChecker.isTrue(forwardX > 0, "forwardX should be positive"); ArgumentChecker.isTrue(forwardY > 0, "forwardY should be positive"); double[] dataDerivedYDiff = new double[nData]; double[][] gradM = new double[nData][nNormals]; final double[] gradFunctionValueM = new double[nNormals]; final double[][] hessian = new double[nNormals][nNormals]; final double forwardZ = forwardX / forwardY; final double[] dataStrs = dataStrikes; final double[] dataVols = dataVolatilities; final double time = timeToExpiry; final double[] wghts = weights; final double[] sigsX = sigmasX; final double[] sigsY = sigmasY; final double[] rpfsX = relativePartialForwardsX; final double[] rpfsY = relativePartialForwardsY; _rhosGuess = rhosGuess; Arrays.fill(gradFunctionValueM, 0.); for (int i = 0; i < nNormals; ++i) { Arrays.fill(hessian[i], 0.); } int k = 0; double rho = 0.; _shift = 0; double shiftModFac = 2.; boolean done = false; double[] rhosJump = new double[nNormals]; gradM = exactFunctionDerivative(_rhosGuess, dataStrs, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); dataDerivedYDiff = exactFunctionValue(_rhosGuess, dataStrs, dataVols, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); for (int i = 0; i < nNormals; ++i) { for (int j = 0; j < nData; ++j) { gradFunctionValueM[i] += -gradM[j][i] * dataDerivedYDiff[j]; } } for (int i = 0; i < nNormals; ++i) { for (int j = 0; j < nNormals; ++j) { for (int l = 0; l < nData; ++l) { hessian[i][j] += gradM[l][i] * gradM[l][j]; } } } for (int i = 0; i < nNormals; ++i) { if (hessian[i][i] > _shift) { _shift = hessian[i][i]; } } _shift = TAU * _shift; _iniSqu = 0.5 * getVecNormSq(exactFunctionValue(_rhosGuess, dataStrs, dataVols, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ)); if (getVecNorm(gradFunctionValueM) <= EPS_1) { done = true; final double[] tmp = exactFunctionValue(_rhosGuess, dataStrs, dataVols, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); _finalSqu = 0.5 * getVecNormSq(tmp); } while (done == false && k < ITRMAX) { k = k + 1; boolean confRhos = false; while (confRhos == false) { rhosJump = theMatrixEqnSolver(dataStrs, dataVols, gradFunctionValueM, hessian, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); int nOutOfRange = 0; for (int i = 0; i < nNormals; ++i) { final double tmpGuess = _rhosGuess[i] + rhosJump[i]; if (tmpGuess < -1. || tmpGuess > 1. || Double.isNaN(tmpGuess)) { ++nOutOfRange; } } if (nOutOfRange == 0) { confRhos = true; } else { for (int i = 0; i < nNormals; ++i) { _rhosGuess[i] = _randObj.nextDouble(); } gradM = exactFunctionDerivative(_rhosGuess, dataStrs, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); dataDerivedYDiff = exactFunctionValue(_rhosGuess, dataStrs, dataVols, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); for (int i = 0; i < nNormals; ++i) { for (int j = 0; j < nData; ++j) { gradFunctionValueM[i] += -gradM[j][i] * dataDerivedYDiff[j]; } } for (int i = 0; i < nNormals; ++i) { for (int j = 0; j < nNormals; ++j) { for (int l = 0; l < nData; ++l) { hessian[i][j] += gradM[l][i] * gradM[l][j]; } } } _shift = 0.; for (int i = 0; i < nNormals; ++i) { if (hessian[i][i] > _shift) { _shift = hessian[i][i]; } } _shift = TAU * _shift; } } if (getVecNorm(rhosJump) <= EPS_2 * (getVecNorm(_rhosGuess) + EPS_2)) { done = true; _rhosGuess = addVectors(_rhosGuess, rhosJump); _finalSqu = 0.5 * getVecNormSq(exactFunctionValue(_rhosGuess, dataStrs, dataVols, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ)); } else { rho = getGainRatio(rhosJump, dataStrs, dataVols, gradFunctionValueM, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); _rhosGuess = addVectors(_rhosGuess, rhosJump); if (rho > 0.) { Arrays.fill(gradFunctionValueM, 0.); for (int i = 0; i < nNormals; ++i) { Arrays.fill(hessian[i], 0.); } gradM = exactFunctionDerivative(_rhosGuess, dataStrs, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); dataDerivedYDiff = exactFunctionValue(_rhosGuess, dataStrs, dataVols, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ); for (int i = 0; i < nNormals; ++i) { for (int j = 0; j < nData; ++j) { gradFunctionValueM[i] += -gradM[j][i] * dataDerivedYDiff[j]; } } for (int i = 0; i < nNormals; ++i) { for (int j = 0; j < nNormals; ++j) { for (int l = 0; l < nData; ++l) { hessian[i][j] += gradM[l][i] * gradM[l][j]; } } } if (getVecNorm(gradFunctionValueM) <= EPS_1) { _finalSqu = 0.5 * getVecNormSq(exactFunctionValue(_rhosGuess, dataStrs, dataVols, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ)); done = true; } _shift = _shift * Math.max(1. / 3., 1. - (2. * rho - 1.) * (2. * rho - 1.) * (2. * rho - 1.)); shiftModFac = 2.; } else { _shift = _shift * shiftModFac; shiftModFac = 2. * shiftModFac; } } if (k == ITRMAX) { s_logger.error("Too many iterations"); _finalSqu = 0.5 * getVecNormSq(exactFunctionValue(_rhosGuess, dataStrs, dataVols, time, wghts, sigsX, sigsY, rpfsX, rpfsY, forwardZ)); } } }  void doFit(final double[] rhosGuess, final double[] dataStrikes, final double[] dataVolatilities, final double timeToExpiry, final double[] weights, final double[] sigmasX,
      final double[] sigmasY,
      final double[] relativePartialForwardsX, final double[] relativePartialForwardsY, final double forwardX, final double forwardY); double getInitialSq(); double getFinalSq(); double[] getParams();  }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullweightsTest() { final double[] weights = null; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullsigmasXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = null; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullsigmasYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = null; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullrelativePartialForwardsXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = null; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nullrelativePartialForwardsYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = null; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nulldataStrikesTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = null; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void nulldataVolsTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = null; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongLengthsigmasXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385, 0.2 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongLengthsigmasYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784, 0.1 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongLengthrelativePartialForwardsXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986, 0.1 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongLengthweightsrelativePartialForwardsYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235, 0.1 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void wrongDataLengthTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686, 0.05 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void negativeForwardXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = -1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void negativeForwardYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = -1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void negativeTimeToExpiryTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = -0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFweightsTest() { final double[] weights = {INF, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFsigmasXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {INF, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFsigmasYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {INF, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFrelativePartialForwardsXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {INF, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFrelativePartialForwardsYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {INF, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFforwardXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = INF; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFforwardYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = INF; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFtimeToExpiryTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = INF; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFdataStrikesTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {INF, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFdataVolsTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, INF, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void iNFrhosGuessTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {INF, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNweightsTest() { final double[] weights = {Double.NaN, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNsigmasXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {Double.NaN, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNsigmasYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {Double.NaN, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNrelativePartialForwardsXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {Double.NaN, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNrelativePartialForwardsYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, Double.NaN }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNforwardXTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = Double.NaN; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNforwardYTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = Double.NaN; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNtimeToExpiryTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = Double.NaN; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNdataStrikesTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, Double.NaN, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNdataVolsTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, Double.NaN, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, 0.65 }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }
@Test(expectedExceptions = IllegalArgumentException.class) public void naNrhosGuessTest() { final double[] weights = {0.37640291143644194, 0.623597088563558 }; final double[] sigmasX = {0.06354423944935964, 0.10361640830108385 }; final double[] sigmasY = {0.03794692512570427, 0.07364831519062784 }; final double[] relativePartialForwardsX = {0.9997760696332433, 1.0001351642647986 }; final double[] relativePartialForwardsY = {1.0002606663941294, 0.999842661886235 }; final double forwardX = 1.3364015890354652; final double forwardY = 1.5992978529959616; final double timeToExpiry = 0.019178082191780823; final double[] dataStrikes = {0.8276533748061506, 0.830544004818981, 0.8356246758244018, 0.8408571903798175, 0.8438972913060586 }; final double[] dataVols = {0.0668, 0.0653, 0.06465, 0.0668, 0.0686 }; final double[] rhosGuess = new double[] {0.65, Double.NaN }; final MixedBivariateLogNormalCorrelationFinder fitter = new MixedBivariateLogNormalCorrelationFinder(); fitter.doFit(rhosGuess, dataStrikes, dataVols, timeToExpiry, weights, sigmasX, sigmasY, relativePartialForwardsX, relativePartialForwardsY, forwardX, forwardY); }