Package com.opengamma.analytics.math.statistics.leastsquare

Examples of com.opengamma.analytics.math.statistics.leastsquare.LeastSquareResultsWithTransform


          final double[] sigma = sigmaList.toDoubleArray();
          final double[] errors = errorsList.toDoubleArray();
          ArrayUtils.reverse(strikes);
          ArrayUtils.reverse(sigma);
          ArrayUtils.reverse(errors);
          final LeastSquareResultsWithTransform fittedResult = new HestonModelFitter(forward, strikes, t, sigma, errors, HESTON_FUNCTION).solve(HESTON_INITIAL_VALUES);
          final DoubleMatrix1D parameters = fittedResult.getModelParameters();
          fittedOptionExpiryList.add(t);
          futureDelayList.add(0);
          kappaList.add(parameters.getEntry(0));
          thetaList.add(parameters.getEntry(1));
          vol0List.add(parameters.getEntry(2));
          omegaList.add(parameters.getEntry(3));
          rhoList.add(parameters.getEntry(4));
          inverseJacobians.put(DoublesPair.of(t.doubleValue(), 0.), fittedResult.getModelParameterSensitivityToData());
          chiSqList.add(fittedResult.getChiSq());
        }
      }
    }
    if (fittedOptionExpiryList.size() < 5) { //don't have sufficient fits to construct a surface
      throw new OpenGammaRuntimeException("Could not construct Heston parameter surfaces; have under 5 surface points");
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));
            betaList.add(parameters.getEntry(1));
            nuList.add(parameters.getEntry(2));
            rhoList.add(parameters.getEntry(3));
            inverseJacobians.put(DoublesPair.of(ttm.doubleValue(), 0.), fittedResult.getModelParameterSensitivityToData());
            chiSqList.add(fittedResult.getChiSq());
            dataPointsForStrip.put(ttm.doubleValue(), fittedPointsForStrip);
          }
        } catch (final IllegalArgumentException e) {
          s_logger.info("Could not get values for forward for x={}", ttm);
        }
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));
            rhoList.add(parameters.getEntry(2));
            nuList.add(parameters.getEntry(3));
            final DoublesPair expiryMaturityPair = new DoublesPair(swaptionExpiry, maturity);
            inverseJacobians.put(expiryMaturityPair, fittedResult.getModelParameterSensitivityToData());
            chiSqList.add(fittedResult.getChiSq());
            fittedSmileIds.put(tenorPair, externalIds);
            fittedRelativeStrikes.put(tenorPair, relativeStrikes);
          }
        }
      }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.math.statistics.leastsquare.LeastSquareResultsWithTransform

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.