Class ForwardSensitivities
java.lang.Object
net.finmath.montecarlo.automaticdifferentiation.forwardsensitivities.ForwardSensitivities
Provides static methods to obtain reduced stochastic hedge ratios dV/dP_j.
The hedge ratios are represented in a finite solution basis
\[ phi_j^r(omega_l) = sum_q xi_j^q X_q(omega_l) \text{.} \]
Two reduced coefficient criteria are supported:
ForwardSensitivities.ReductionMethod.L2: minimize the full empirical pathwise residual 1/N sum_l ||A_l phi_l^r - b_l||^2.ForwardSensitivities.ReductionMethod.PROJECTED_GALERKIN: impose the projected moment equations <A phi^r - b, Y_s>_N = 0, where Y_s may differ from the solution basis X_q.
- Author:
- Christian Fries
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classResult container for a reduced stochastic hedge-ratio calculation.static enumThe reduced coefficient criterion used to determine the basis coefficients. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetDifferentiableModelParameterIDs(IndependentModelParameterProvider parameterProvider) Extract differentiable model parameters M_i and their AAD IDs.getHedgeRatios(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] solutionBasisFunctions, RandomVariable[] testBasisFunctions, double regularizationLambda, ForwardSensitivities.ReductionMethod reductionMethod) General reduced stochastic hedge-ratio calculation supporting both coefficient criteria.getHedgeRatiosEmpiricalL2(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] basisFunctions, double regularizationLambda) Reduced empirical L2 stochastic hedge-ratio calculation.getHedgeRatiosProjected(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] basisFunctions, double regularizationLambda) Backwards-compatible projected stochastic hedge-ratio calculation.getHedgeRatiosProjected(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] solutionBasisFunctions, RandomVariable[] testBasisFunctions, double regularizationLambda) Projected stochastic hedge-ratio calculation with separate solution and test bases.getHedgeRatiosReduced(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] basisFunctions, double regularizationLambda, ForwardSensitivities.ReductionMethod reductionMethod) General reduced stochastic hedge-ratio calculation supporting both coefficient criteria.
-
Constructor Details
-
ForwardSensitivities
public ForwardSensitivities()
-
-
Method Details
-
getHedgeRatiosProjected
public static ForwardSensitivities.ProjectedHedgeRatioResult getHedgeRatiosProjected(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] basisFunctions, double regularizationLambda) throws CalculationExceptionBackwards-compatible projected stochastic hedge-ratio calculation. This solves the projected/Galerkin moment equations using the same basis for the solution and test spaces, <(A phi^r - b)_i, X_s>_N = 0.- Throws:
CalculationException
-
getHedgeRatiosProjected
public static ForwardSensitivities.ProjectedHedgeRatioResult getHedgeRatiosProjected(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] solutionBasisFunctions, RandomVariable[] testBasisFunctions, double regularizationLambda) throws CalculationExceptionProjected stochastic hedge-ratio calculation with separate solution and test bases. The hedge ratios use the solution basis X_q, phi_j^r = sum_q xi_j^q X_q, while the residual is tested against Y_s, <(A phi^r - b)_i, Y_s>_N = 0. Taking Y_s = X_s gives the Galerkin case. Different Y_s give a Petrov-Galerkin projected moment system.- Throws:
CalculationException
-
getHedgeRatiosEmpiricalL2
public static ForwardSensitivities.ProjectedHedgeRatioResult getHedgeRatiosEmpiricalL2(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] basisFunctions, double regularizationLambda) throws CalculationExceptionReduced empirical L2 stochastic hedge-ratio calculation. This solves min_xi 1/N sum_l ||A_l phi_l^r - b_l||_2^2 + lambda ||xi||_2^2, without projecting the output residual onto the hedge-ratio basis.- Throws:
CalculationException
-
getHedgeRatiosReduced
public static ForwardSensitivities.ProjectedHedgeRatioResult getHedgeRatiosReduced(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] basisFunctions, double regularizationLambda, ForwardSensitivities.ReductionMethod reductionMethod) throws CalculationExceptionGeneral reduced stochastic hedge-ratio calculation supporting both coefficient criteria.- Parameters:
parameterIDsByName- Map of model-parameter names to AAD IDs.evaluationTime- The time t at which the hedge ratios are calculated.derivativeValue- The product value V.hedgePortfolioValues- The hedge-instrument values P_j.basisFunctions- Basis random variables X_q evaluated on the same paths. For PROJECTED_GALERKIN this basis is used both as solution and test basis.regularizationLambda- Lambda in the selected regularized criterion. Use 0.0 for unregularized.reductionMethod- The reduced coefficient criterion.- Returns:
- stochastic hedge ratios and reduced-system diagnostics.
- Throws:
CalculationException
-
getHedgeRatios
public static ForwardSensitivities.ProjectedHedgeRatioResult getHedgeRatios(Map<String, Long> parameterIDsByName, double evaluationTime, RandomVariable derivativeValue, RandomVariable[] hedgePortfolioValues, RandomVariable[] solutionBasisFunctions, RandomVariable[] testBasisFunctions, double regularizationLambda, ForwardSensitivities.ReductionMethod reductionMethod) throws CalculationExceptionGeneral reduced stochastic hedge-ratio calculation supporting both coefficient criteria.- Parameters:
parameterIDsByName- Map of model-parameter names to AAD IDs.evaluationTime- The time t at which the hedge ratios are calculated.derivativeValue- The product value V.hedgePortfolioValues- The hedge-instrument values P_j.solutionBasisFunctions- Basis random variables X_q used for the hedge ratios.testBasisFunctions- Basis random variables Y_s used for PROJECTED_GALERKIN moments. May be null for L2. If null for PROJECTED_GALERKIN, the solution basis is used as the test basis.regularizationLambda- Lambda in the selected regularized criterion. Use 0.0 for unregularized.reductionMethod- The reduced coefficient criterion.- Returns:
- stochastic hedge ratios and reduced-system diagnostics.
- Throws:
CalculationException
-
getDifferentiableModelParameterIDs
public static Map<String,Long> getDifferentiableModelParameterIDs(IndependentModelParameterProvider parameterProvider) Extract differentiable model parameters M_i and their AAD IDs.
-