net.finmath.montecarlo.hybridassetinterestrate.ConvexityAdjustedModel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finmath-lib Show documentation
Show all versions of finmath-lib Show documentation
finmath lib is a Mathematical Finance Library in Java.
It provides algorithms and methodologies related to mathematical finance.
/*
* (c) Copyright Christian P. Fries, Germany. Contact: [email protected].
*
* Created on 07.05.2013
*/
package net.finmath.montecarlo.hybridassetinterestrate;
import java.util.Map;
import net.finmath.exception.CalculationException;
import net.finmath.montecarlo.model.ProcessModel;
import net.finmath.montecarlo.process.MonteCarloProcess;
import net.finmath.stochastic.RandomVariable;
/**
* A general convexity adjustment for models.
*
* @author Christian Fries
*/
public class ConvexityAdjustedModel {
private final ProcessModel baseModel;
private final MonteCarloProcess measureTransformModel;
private final Map factorLoadingMap;
public ConvexityAdjustedModel(ProcessModel baseModel, MonteCarloProcess measureTransformModel, Map factorLoadingMap) {
super();
this.baseModel = baseModel;
this.measureTransformModel = measureTransformModel;
this.factorLoadingMap = factorLoadingMap;
}
public RandomVariable[] getDrift(RandomVariable[] driftUnadjusted, MonteCarloProcess process, int timeIndex, RandomVariable[] realizationAtTimeIndex, RandomVariable[] realizationPredictor) {
/*
* Add convexity adjustment
*/
final RandomVariable[] driftAdjusted = new RandomVariable[baseModel.getNumberOfComponents()];
RandomVariable[] processValueTransformModel = null;
try {
processValueTransformModel = measureTransformModel.getProcessValue(timeIndex);
for(int componentIndex=0; componentIndex