Class SmileModelFitter<T extends SmileModelData>

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

    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.

        Parameters:
        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.

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

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

        protected abstract NonLinearParameterTransforms getTransform​(DoubleArray start)
        Obtains the nonlinear transformation of parameters from the initial values.
        Parameters:
        start - the initial values
        Returns:
        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.
        Parameters:
        start - the initial values
        fixed - the parameters are fixed
        Returns:
        the nonlinear transformation
      • toSmileModelData

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

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

        This is defaulted to be "unconstrained".

        Parameters:
        t - the nonlinear transformation
        Returns:
        the constraint function
      • getModel

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