All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.finmath.montecarlo.interestrate.models.covariance.DisplacedLocalVolatilityModel Maven / Gradle / Ivy

Go to download

finmath lib is a Mathematical Finance Library in Java. It provides algorithms and methodologies related to mathematical finance.

There is a newer version: 6.0.19
Show newest version
/*
 * (c) Copyright Christian P. Fries, Germany. Contact: [email protected].
 *
 * Created on 26.05.2013
 */
package net.finmath.montecarlo.interestrate.models.covariance;

import net.finmath.marketdata.model.curves.ForwardCurve;
import net.finmath.stochastic.RandomVariable;
import net.finmath.stochastic.Scalar;

/**
 * Displaced model build on top of a standard covariance model.
 *
 * The model constructed for the i-th factor loading is
 * 
* (Li(t) + d) Fi(t) *
* where d is the displacement and Li is * the realization of the i-th component of the stochastic process and * Fi is the factor loading from the given covariance model. * * The parameter of this model is a joint parameter vector, consisting * of the parameter vector of the given base covariance model and * appending the displacement parameter at the end. * * If this model is not calibrateable, its parameter vector is that of the * covariance model, i.e., only the displacement parameter will be not * part of the calibration. * * @author Christian Fries * @version 1.0 */ public class DisplacedLocalVolatilityModel extends AbstractLIBORCovarianceModelParametric { private static final long serialVersionUID = 4522227972747028512L; private AbstractLIBORCovarianceModelParametric covarianceModel; private RandomVariable displacement; private ForwardCurve forwardCurve; private boolean isCalibrateable = false; /** * Displaced model build on top of a standard covariance model. * * The model constructed for the i-th factor loading is *
* (Li(t) + d) Fi(t) *
* where d is the displacement and Li is * the realization of the i-th component of the stochastic process and * Fi is the factor loading from the given covariance model. * * The parameter of this model is a joint parameter vector, consisting * of the parameter vector of the given base covariance model and * appending the displacement parameter at the end. * * If this model is not calibrateable, its parameter vector is that of the * covariance model, i.e., only the displacement parameter will be not * part of the calibration. * * @param covarianceModel The given covariance model specifying the factor loadings F. * @param displacement The displacement a. * @param isCalibrateable If true, the parameter a is a free parameter. Note that the covariance model may have its own parameter calibration settings. */ public DisplacedLocalVolatilityModel(AbstractLIBORCovarianceModelParametric covarianceModel, RandomVariable displacement, boolean isCalibrateable) { super(covarianceModel.getTimeDiscretization(), covarianceModel.getLiborPeriodDiscretization(), covarianceModel.getNumberOfFactors()); this.covarianceModel = covarianceModel; this.displacement = displacement; this.isCalibrateable = isCalibrateable; } /** * Displaced model build on top of a standard covariance model. * * The model constructed for the i-th factor loading is *
* (Li(t) + d) Fi(t) *
* where d is the displacement and Li is * the realization of the i-th component of the stochastic process and * Fi is the factor loading from the given covariance model. * * The parameter of this model is a joint parameter vector, consisting * of the parameter vector of the given base covariance model and * appending the displacement parameter at the end. * * If this model is not calibrateable, its parameter vector is that of the * covariance model, i.e., only the displacement parameter will be not * part of the calibration. * * @param covarianceModel The given covariance model specifying the factor loadings F. * @param displacement The displacement a. * @param isCalibrateable If true, the parameter a is a free parameter. Note that the covariance model may have its own parameter calibration settings. */ public DisplacedLocalVolatilityModel(AbstractLIBORCovarianceModelParametric covarianceModel, double displacement, boolean isCalibrateable) { super(covarianceModel.getTimeDiscretization(), covarianceModel.getLiborPeriodDiscretization(), covarianceModel.getNumberOfFactors()); this.covarianceModel = covarianceModel; this.displacement = new Scalar(displacement); this.isCalibrateable = isCalibrateable; } @Override public Object clone() { return new DisplacedLocalVolatilityModel((AbstractLIBORCovarianceModelParametric) covarianceModel.clone(), displacement, isCalibrateable); } /** * Returns the base covariance model, i.e., the model providing the factor loading F * such that this model's i-th factor loading is *
* (a Li,0 + (1-a)Li(t)) Fi(t) *
* where a is the displacement and Li is * the realization of the i-th component of the stochastic process and * Fi is the factor loading loading from the given covariance model. * * @return The base covariance model. */ public AbstractLIBORCovarianceModelParametric getBaseCovarianceModel() { return covarianceModel; } @Override public RandomVariable[] getParameter() { if(!isCalibrateable) { return covarianceModel.getParameter(); } RandomVariable[] covarianceParameters = covarianceModel.getParameter(); if(covarianceParameters == null) { return new RandomVariable[] { displacement }; } // Append displacement to the end of covarianceParameters RandomVariable[] jointParameters = new RandomVariable[covarianceParameters.length+1]; System.arraycopy(covarianceParameters, 0, jointParameters, 0, covarianceParameters.length); jointParameters[covarianceParameters.length] = displacement; return jointParameters; } @Override public double[] getParameterAsDouble() { RandomVariable[] parameters = getParameter(); double[] parametersAsDouble = new double[parameters.length]; for(int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy