public void Populate(IStochasticProcess container, EstimationResult estimate) { bool found; this.s0 = new ModelParameter(PopulateHelper.GetValue("S0", estimate.Names, estimate.Values, out found), this.s0.Description); bool errors = RetrieveCurve(container.Context, false); if (!errors) { PFunction rFunc = estimate.Objects[0] as PFunction; PFunction rFuncDest = this.r.fVRef() as PFunction; rFuncDest.Expr = rFunc.Expr; PFunction qFunc = estimate.Objects[1] as PFunction; PFunction qFuncDest = this.q.fVRef() as PFunction; qFuncDest.Expr = qFunc.Expr; //Calibrator assumes dividend yield is a step constant function, the simulation model must be coherent with that assumption. qFuncDest.m_Function.iType = DVPLUtils.EInterpolationType.ZERO_ORDER_LEFT; PFunction2D.PFunction2D localVolSrc = estimate.Objects[2] as PFunction2D.PFunction2D; PFunction2D.PFunction2D localVolDest = this.localVol.fVRef() as PFunction2D.PFunction2D; localVolDest.Expr = localVolSrc.Expr; localVolDest.Interpolation = localVolSrc.Interpolation; } }
public static StochasticManifoldPoint Apply(this IStochasticProcess process, StochasticManifoldPoint stochasticPoint, double time) { var diff = process.ExpectationDifferential(stochasticPoint.Expectation, time); var prediction = process.Apply(stochasticPoint.Expectation, time); return(new StochasticManifoldPoint(prediction.Expectation, stochasticPoint.Covariance.Conjugate(diff) + prediction.Covariance)); }
/// <summary> /// Populate editable fields from name and value vectors /// specific to the Heston extended process. /// </summary> /// <param name="stocProcess"> /// The stochastic process which is being referenced to. /// </param> /// <param name="estimate"> /// The estimation result which contains values and names of parameters. /// It will be searched for S0, kappa, theta, sigma, V0 and rho. /// </param> public void Populate(IStochasticProcess stocProcess, EstimationResult estimate) { bool found; this.S0 = new ModelParameter(PopulateHelper.GetValue("S0", estimate.Names, estimate.Values, out found), this.S0.Description); this.k = new ModelParameter(PopulateHelper.GetValue("kappa", estimate.Names, estimate.Values, out found), this.k.Description); this.theta = new ModelParameter(PopulateHelper.GetValue("theta", estimate.Names, estimate.Values, out found), this.theta.Description); this.sigma = new ModelParameter(PopulateHelper.GetValue("sigma", estimate.Names, estimate.Values, out found), this.sigma.Description); this.V0 = new ModelParameter(PopulateHelper.GetValue("V0", estimate.Names, estimate.Values, out found), this.V0.Description); int index = stocProcess.NoiseIndex; ProjectProcess prj = stocProcess.Context as ProjectProcess; // Update the correlation matrix. prj.Processes.r.Set(index, index + 1, (RightValue)PopulateHelper.GetValue("rho", estimate.Names, estimate.Values, out found)); bool errors = RetrieveCurve(stocProcess.Context, false); if (!errors) { this.zrCurve.Expr = (estimate.Objects[0] as Matrix).ToArray(); this.dyCurve.Expr = (estimate.Objects[1] as Matrix).ToArray(); //Calibrator assumes dividend yield is a step constant function, the simulation model must be coherent with that assumption. (this.dyCurve as PFunction).m_Function.iType = DVPLUtils.EInterpolationType.ZERO_ORDER_LEFT; } }
public TotalIntegralStochasticProcess(IStochasticProcess baseProcess, IManifold fiber) : base(baseProcess, fiber) { if (!(baseProcess.StateSpace is AffineSpace)) { throw new ArgumentException("Expected process in affine space", "baseProcess"); } }
/* * /// <summary> * /// Populate editable fields from name and value vectors * /// specific to HW. * /// </summary> * /// <param name="names"> * /// An array with the names of the variable, * /// will search for alpha (or a1), sigma (or sigma1). * /// </param> * /// <param name="values">The values associated to the parameters in names.</param> * public void Populate(string[] names, double[] values) * { * bool found = false; * this.alpha1 = new ModelParameter(PopulateHelper.GetValue("alpha", "a1", names, values, out found), alphaDescription); * this.sigma1 = new ModelParameter(PopulateHelper.GetValue("sigma", "sigma1", names, values, out found), sigmaDescription); * this.lambda0 = new ModelParameter(PopulateHelper.GetValue("Lambda0", "lambda0", names, values, out found), lambda0Description); * } */ /// <summary> /// Populate editable fields from name and value vectors /// specific to the Heston extended process. /// </summary> /// <param name="stocProcess"> /// The stochastic process which is being referenced to. /// </param> /// <param name="estimate"> /// The estimation result which contains values and names of parameters. /// It will be searched for S0, kappa, theta, sigma, V0 and rho. /// </param> public void Populate(IStochasticProcess stocProcess, EstimationResult estimate) { bool found; this.alpha1 = new ModelParameter(PopulateHelper.GetValue("alpha", "a1", estimate.Names, estimate.Values, out found), alphaDescription); this.sigma1 = new ModelParameter(PopulateHelper.GetValue("sigma", "sigma1", estimate.Names, estimate.Values, out found), sigmaDescription); this.lambda0 = new ModelParameter(PopulateHelper.GetValue("Lambda0", "lambda0", estimate.Names, estimate.Values, out found), lambda0Description); }
public static void ValidateProcess(IStochasticProcess process, IManifoldPoint point, double time, double eps, double tolerance) { var trivialEvolution = process.Apply(point, time: 0); Assert.That(process.StateSpace.GetTranslation(trivialEvolution.Expectation, point).Norm(), Is.LessThan(_tolerance)); Assert.That(trivialEvolution.Covariance.FrobeniusNorm(), Is.LessThan(_tolerance)); ValidateMappingDifferential(process.Apply(time), point, eps, tolerance); }
public KalmanFilter(IStochasticProcess processModel, StochasticManifoldPoint initialEstimate, double initialTime) { ArgAssert.NotNull(processModel, "processModel"); ArgAssert.Equal(processModel.StateSpace.Dimension, "processModel.StateSpace.Dimension", initialEstimate.Dimension, "initialEstimate.Dimension"); _time = initialTime; _estimate = initialEstimate; _processModel = processModel; }
public AffineIntegralStochasticProcess(IStochasticProcess baseProcess, IManifold fiber, OMatrix gain, OVector offset) : base(baseProcess, fiber) { if (!(baseProcess.StateSpace is AffineSpace)) { throw new ArgumentException("Expected process in affine space", "baseProcess"); } ArgAssert.Equal(baseProcess.StateSpace.Dimension, "baseProcess.StateSpace.Dimension", gain.ColumnCount, "gain.ColumnCount"); ArgAssert.Equal(fiber.Dimension, "fiber.Dimension", gain.RowCount, "gain.RowCount"); ArgAssert.Equal(offset.Dimension, "offset.Dimension", gain.RowCount, "gain.RowCount"); _gain = gain; _offset = offset; }
/// <summary> /// Populate editable fields from name and value vectors /// specific to the CIR process. /// </summary> /// <param name="container"> /// The stochastic process which is being referenced to. /// </param> /// <param name="estimate"> /// The estimation result which contains values and names of parameters. /// </param> public void Populate(IStochasticProcess container, EstimationResult estimate) { bool found; this.parameterValues = new double[4]; for (int i = 0; i < parameterNames.Length; i++) { this.parameterValues[i] = PopulateHelper.GetValue(parameterNames[i], estimate.Names, estimate.Values, out found); Console.WriteLine("ParameterValues[{0}] = {1}\t ParameterNames[{0}] = {2}", i, this.parameterValues[i], parameterNames[i]); } SetParametersValue(); }
/// <summary> /// Populate editable fields from name and value vectors /// specific to the Heston extended process. /// </summary> /// <param name="stocProcess"> /// The stochastic process which is being referenced to. /// </param> /// <param name="estimate"> /// The estimation result which contains values and names of parameters. /// It will be searched for S0, kappa, theta, sigma, V0, r, q and rho. /// </param> public void Populate(IStochasticProcess stocProcess, EstimationResult estimate) { bool found; this.S0 = new ModelParameter(PopulateHelper.GetValue("S0", estimate.Names, estimate.Values, out found), this.S0.Description); this.k = new ModelParameter(PopulateHelper.GetValue("kappa", estimate.Names, estimate.Values, out found), this.k.Description); this.theta = new ModelParameter(PopulateHelper.GetValue("theta", estimate.Names, estimate.Values, out found), this.theta.Description); this.sigma = new ModelParameter(PopulateHelper.GetValue("sigma", estimate.Names, estimate.Values, out found), this.sigma.Description); this.V0 = new ModelParameter(PopulateHelper.GetValue("V0", estimate.Names, estimate.Values, out found), this.V0.Description); this.r = new ModelParameter(PopulateHelper.GetValue("r", estimate.Names, estimate.Values, out found), this.r.Description); this.q = new ModelParameter(PopulateHelper.GetValue("q", estimate.Names, estimate.Values, out found), this.q.Description); int index = stocProcess.NoiseIndex; ProjectProcess prj = stocProcess.Context as ProjectProcess; // Updates the correlation. prj.Processes.r.Set(index, index + 1, (RightValue)PopulateHelper.GetValue("rho", estimate.Names, estimate.Values, out found)); }
public IntegralStochasticProcess(IStochasticProcess baseProcess, IManifold fiber) : base(baseProcess, fiber) { }
private ExtensionStochasticProcess CreateIntegralProcess(IStochasticProcess baseProcess) { return(new AffineIntegralStochasticProcess(baseProcess, new AffineSpace(_gain.RowCount), _gain, _offset)); }
public static IStochasticMapping Apply(this IStochasticProcess process, double time) { return(new StochasticProcessTimeSlice(process, time)); }
public StochasticProcessTimeSlice(IStochasticProcess process, double time) { _process = process; _time = time; }
public ExtensionStochasticProcess(IStochasticProcess baseProcess, IManifold fiber) { _baseProcess = baseProcess; _stateSpace = new ProductManifold(_baseProcess.StateSpace, fiber); }
/* /// <summary> /// Populate editable fields from name and value vectors /// specific to HW. /// </summary> /// <param name="names"> /// An array with the names of the variable, /// will search for alpha (or a1), sigma (or sigma1). /// </param> /// <param name="values">The values associated to the parameters in names.</param> public void Populate(string[] names, double[] values) { bool found = false; this.alpha1 = new ModelParameter(PopulateHelper.GetValue("alpha", "a1", names, values, out found), alphaDescription); this.sigma1 = new ModelParameter(PopulateHelper.GetValue("sigma", "sigma1", names, values, out found), sigmaDescription); this.lambda0 = new ModelParameter(PopulateHelper.GetValue("Lambda0", "lambda0", names, values, out found), lambda0Description); } */ /// <summary> /// Populate editable fields from name and value vectors /// specific to the Heston extended process. /// </summary> /// <param name="stocProcess"> /// The stochastic process which is being referenced to. /// </param> /// <param name="estimate"> /// The estimation result which contains values and names of parameters. /// It will be searched for S0, kappa, theta, sigma, V0 and rho. /// </param> public void Populate(IStochasticProcess stocProcess, EstimationResult estimate) { bool found; this.alpha1 = new ModelParameter(PopulateHelper.GetValue("alpha", "a1", estimate.Names, estimate.Values, out found), alphaDescription); this.sigma1 = new ModelParameter(PopulateHelper.GetValue("sigma", "sigma1", estimate.Names, estimate.Values, out found), sigmaDescription); this.lambda0 = new ModelParameter(PopulateHelper.GetValue("Lambda0", "lambda0", estimate.Names, estimate.Values, out found), lambda0Description); }