T - the data of smile model to be calibratedpublic abstract class SmileModelFitter<T extends SmileModelData> extends Object
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 and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
protected Function<DoubleArray,Boolean> |
getConstraintFunction(com.opengamma.strata.math.impl.minimization.NonLinearParameterTransforms t)
Obtains the constraint function.
|
protected abstract DoubleArray |
getMaximumStep()
Obtains the maximum number of iterations.
|
VolatilityFunctionProvider<T> |
getModel()
Obtains the volatility function provider.
|
protected Function<DoubleArray,DoubleMatrix> |
getModelJacobianFunction()
Obtains Jacobian function of the smile model.
|
protected Function<DoubleArray,DoubleArray> |
getModelValueFunction()
Obtains volatility function of the smile model.
|
protected abstract com.opengamma.strata.math.impl.minimization.NonLinearParameterTransforms |
getTransform(DoubleArray start)
Obtains the nonlinear transformation of parameters from the initial values.
|
protected abstract com.opengamma.strata.math.impl.minimization.NonLinearParameterTransforms |
getTransform(DoubleArray start,
BitSet fixed)
Obtains the nonlinear transformation of parameters from the initial values with some parameters fixed.
|
com.opengamma.strata.math.impl.statistics.leastsquare.LeastSquareResultsWithTransform |
solve(DoubleArray start)
Solves using the default NonLinearParameterTransforms for the concrete implementation.
|
com.opengamma.strata.math.impl.statistics.leastsquare.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).
|
com.opengamma.strata.math.impl.statistics.leastsquare.LeastSquareResultsWithTransform |
solve(DoubleArray start,
com.opengamma.strata.math.impl.minimization.NonLinearParameterTransforms transform)
Solve using a user supplied NonLinearParameterTransforms.
|
abstract T |
toSmileModelData(DoubleArray modelParameters)
Obtains
SmileModelData instance from the model parameters. |
public SmileModelFitter(double forward,
DoubleArray strikes,
double timeToExpiry,
DoubleArray impliedVols,
DoubleArray error,
VolatilityFunctionProvider<T> model)
strikes, impliedVols and error should be the same length and ordered coherently.
forward - the forward value of the underlyingstrikes - the ordered values of strikestimeToExpiry - the time-to-expiryimpliedVols - the market implied volatilitieserror - 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 providerpublic com.opengamma.strata.math.impl.statistics.leastsquare.LeastSquareResultsWithTransform solve(DoubleArray start)
This returns LeastSquareResults.
start - the first guess at the parameter valuespublic com.opengamma.strata.math.impl.statistics.leastsquare.LeastSquareResultsWithTransform solve(DoubleArray start, BitSet fixed)
This returns LeastSquareResults.
start - the first guess at the parameter valuesfixed - the parameters are fixedpublic com.opengamma.strata.math.impl.statistics.leastsquare.LeastSquareResultsWithTransform solve(DoubleArray start, com.opengamma.strata.math.impl.minimization.NonLinearParameterTransforms transform)
This returns LeastSquareResults.
start - the first guess at the parameter valuestransform - transform from model parameters to fitting parameters, and vice versaprotected Function<DoubleArray,DoubleArray> getModelValueFunction()
The function is defined in VolatilityFunctionProvider.
protected Function<DoubleArray,DoubleMatrix> getModelJacobianFunction()
The function is defined in VolatilityFunctionProvider.
protected abstract DoubleArray getMaximumStep()
protected abstract com.opengamma.strata.math.impl.minimization.NonLinearParameterTransforms getTransform(DoubleArray start)
start - the initial valuesprotected abstract com.opengamma.strata.math.impl.minimization.NonLinearParameterTransforms getTransform(DoubleArray start, BitSet fixed)
start - the initial valuesfixed - the parameters are fixedpublic abstract T toSmileModelData(DoubleArray modelParameters)
SmileModelData instance from the model parameters.modelParameters - the model parametersprotected Function<DoubleArray,Boolean> getConstraintFunction(com.opengamma.strata.math.impl.minimization.NonLinearParameterTransforms t)
This is defaulted to be "unconstrained".
t - the nonlinear transformationpublic VolatilityFunctionProvider<T> getModel()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.