Class SmileModelFitter<T extends SmileModelData>

  • Type Parameters:
    T - the data of smile model to be calibrated
    Direct Known Subclasses:

    public abstract class SmileModelFitter<T extends SmileModelData>
    extends Object
    Smile model fitter.

    Attempts to calibrate a smile model to the implied volatilities of European vanilla options, by minimising the sum of squares between the market and model implied volatilities.

    All the options must be for the same expiry and (implicitly) on the same underlying.

    • Constructor Detail

      • SmileModelFitter

        public SmileModelFitter​(double forward,
                                DoubleArray strikes,
                                double timeToExpiry,
                                DoubleArray impliedVols,
                                DoubleArray error,
                                VolatilityFunctionProvider<T> model)
        Constructs smile model fitter from forward, strikes, time to expiry, implied volatilities and error values.

        strikes, impliedVols and error should be the same length and ordered coherently.

        forward - the forward value of the underlying
        strikes - the ordered values of strikes
        timeToExpiry - the time-to-expiry
        impliedVols - the market implied volatilities
        error - the 'measurement' error to apply to the market volatility of a particular option TODO: Review should this be part of EuropeanOptionMarketData?
        model - the volatility function provider
    • Method Detail

      • solve

        public LeastSquareResultsWithTransform solve​(DoubleArray start,
                                                     BitSet fixed)
        Solve using the default NonLinearParameterTransforms for the concrete implementation with some parameters fixed to their initial values (indicated by fixed).

        This returns LeastSquareResults.

        start - the first guess at the parameter values
        fixed - the parameters are fixed
        the calibration results
      • getMaximumStep

        protected abstract DoubleArray getMaximumStep()
        Obtains the maximum number of iterations.
        the maximum number.
      • getTransform

        protected abstract NonLinearParameterTransforms getTransform​(DoubleArray start)
        Obtains the nonlinear transformation of parameters from the initial values.
        start - the initial values
        the nonlinear transformation
      • getTransform

        protected abstract NonLinearParameterTransforms getTransform​(DoubleArray start,
                                                                     BitSet fixed)
        Obtains the nonlinear transformation of parameters from the initial values with some parameters fixed.
        start - the initial values
        fixed - the parameters are fixed
        the nonlinear transformation
      • toSmileModelData

        public abstract T toSmileModelData​(DoubleArray modelParameters)
        Obtains SmileModelData instance from the model parameters.
        modelParameters - the model parameters
        the smile model data
      • getConstraintFunction

        protected Function<DoubleArray,​Boolean> getConstraintFunction​(NonLinearParameterTransforms t)
        Obtains the constraint function.

        This is defaulted to be "unconstrained".

        t - the nonlinear transformation
        the constraint function
      • getModel

        public VolatilityFunctionProvider<T> getModel()
        Obtains the volatility function provider.
        the volatility function provider