Package com.opengamma.analytics.financial.model.volatility.smile.fitting

Examples of com.opengamma.analytics.financial.model.volatility.smile.fitting.SABRModelFitter


    final SABRFormulaData[] modelParams = new SABRFormulaData[n - 2];

    final double[] errors = new double[n];
    Arrays.fill(errors, 0.0001); //1bps
    final SmileModelFitter<SABRFormulaData> globalFitter = new SABRModelFitter(forward, strikes, expiry, impliedVols, errors, MODEL);
    final BitSet fixed = new BitSet();
    if (n == 3 || !_globalBetaSearch) {
      fixed.set(1); //fixed beta
    }

    //do a global fit first
    final LeastSquareResultsWithTransform gRes = globalFitter.solve(start, fixed);

    if (n == 3) {
      if (gRes.getChiSq() / n > 1.0) {
        s_logger.warn("chi^2 on SABR fit to ", +n + " points is " + gRes.getChiSq());
      }
View Full Code Here


    return new SABRFormulaData(modelParameters.getData());
  }

  @Override
  protected SmileModelFitter<SABRFormulaData> getFitter(final double forward, final double[] strikes, final double expiry, final double[] impliedVols, final double[] errors) {
    return new SABRModelFitter(forward, strikes, expiry, impliedVols, errors, getModel());
  }
View Full Code Here

        final double[] errors = new double[NB_STRIKE];
        for (int loopstr = 0; loopstr < NB_STRIKE; loopstr++) {
          strikeAbs[loopstr] = atm + STRIKE_RELATIVE[loopstr];
          errors[loopstr] = ERROR;
        }
        final LeastSquareResultsWithTransform fittedResult = new SABRModelFitter(atm, strikeAbs, EXPIRY_TIME[loopexpiry], volBlack[loopexpiry][loopmat], errors, SABR_FUNCTION).solve(
            SABR_INITIAL_VALUES, FIXED);
        inverseJacobianMap.put(new DoublesPair(EXPIRY_TIME[loopexpiry], MATURITY_TIME[loopmat]), fittedResult.getModelParameterSensitivityToData());
        expiryTimeVector[vect] = EXPIRY_TIME[loopexpiry];
        maturityTimeVector[vect] = MATURITY_TIME[loopmat];
        alphaVector[vect] = fittedResult.getModelParameters().getEntry(0);
View Full Code Here

              errors.add(error);
              fittedPointsForStrip.add(value.first);
            }
          }
          if (blackVols.size() > 4) {
            final LeastSquareResultsWithTransform fittedResult = new SABRModelFitter(forward, strikes.toDoubleArray(), ttm.doubleValue(), blackVols.toDoubleArray(),
                errors.toDoubleArray(), SABR_FUNCTION).solve(sabrInitialValues, fixed);
            final DoubleMatrix1D parameters = fittedResult.getModelParameters();
            fittedOptionExpiryList.add(ttm.doubleValue());
            futureDelayList.add(0);
            alphaList.add(parameters.getEntry(0));
View Full Code Here

          final double forward = volatilityCubeData.getATMStrikes().get(tenorPair);
          for (int k = 0; k < n; k++) {
            errors[k] = ERROR;
          }
          if (strikes.length > 4 && forward > 0) { //don't fit those smiles with insufficient data
            final LeastSquareResultsWithTransform fittedResult = new SABRModelFitter(forward, strikes, swaptionExpiry, blackVols, errors, SABR_FUNCTION).solve(SABR_INITIAL_VALUES, FIXED);
            final DoubleMatrix1D parameters = fittedResult.getModelParameters();
            swapMaturitiesList.add(maturity);
            swaptionExpiriesList.add(swaptionExpiry);
            alphaList.add(parameters.getEntry(0));
            betaList.add(parameters.getEntry(1));
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.model.volatility.smile.fitting.SABRModelFitter

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.