SERVING THE QUANTITATIVE FINANCE COMMUNITY

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

Sorry in the previous program, In the training one step ahead simulation step, I needed to advance just one subdivision of the density to make a variance comparison. Actually, it could take three consecutive subdivisions.
Obviously in the variants of the program when we do not know the generating SDE and when there could be uncertainty that is not coming off a single SDE, we will have to advance all the density subdivisions and make a different existing to one step ahead variance comparison for all of the subdivisions and use different variance scaling in hermite polynomials associated with each density subdivision.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

When I calculated ratio of variance(or standard deviation to be precise) in my program, I used an approximate value for the subdivision ends. What I used is given here
y0h=X(81)+(X(82)-X(81))/2.0; //higher ending point of subdivision 81
y0l=X(81)-(X(81)-X(80))/2.0;  //lower ending point of subdivision 81
dividing the difference between centres of consecutive subdivisions by two is only approximate but works reasonably well at most places in the density. I want to point out again that these subdivision endpoints were calculated on a non-normal density before the transformation that converts it into a normal density. But I am sure there will be extensions that will calculate subdivision ends employing higher derivatives that will make a sharply precise calculation of subdivision end points and the ratio of standard deviations of existing and one step ahead simulation density.
My calculated value of subdivision ends is only rough but accurate enough and the ratio of standard deviations calculated do change slightly across the density and actually become very inaccurate at start of the density. I believe it is due to the fact that I have made a very rough calculation of subdivision ends.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

When we simulate a simple SDE of the form
$dX(t)=\sigma(t) dz(t)$
for two steps with volatility for individual steps given as $\sigma(t_1)$  and $\sigma(t_2)$
The true integrated variance over time is known obviously as ${\sigma(t_1)}^2 \Delta(t_1) + \sigma(t_2)^2 \Delta(t_2)$
But in the Ito-Taylor density simulation method, the integrated variance is correlated with previous time steps for each time step in time evolution and when we use a hermite polynomial with unit variance for two step simulation, the integrated variance of the density with two step evolution is given as
${\sigma(t_1)}^2 \Delta(t_1) + 2 \sigma(t_1) \sqrt{\Delta(t_1)} \sigma(t_2) \sqrt{\Delta(t_2)} +{\sigma(t_2)}^2 \Delta(t_2)$
Now all friends can see why in the Ito-Taylor density simulation method programs I posted for various SDEs with time homogeneous variance structure and for T step simulation when I used $\frac{1}{\sqrt{T}}$, my variance was matching with true variance since it divided the correlated integrated variance (of the Ito-Taylor density simulation method) by a factor of T and brought it equal to true uncorrelated integrated variance in time.
So we have to design all Ito-Taylor density simulation methods considering that unlike monte carlo integrated variance is no-longer uncorrelated in time in this Ito-Taylor density simulation method and we would have to match integrated variance on each step of the density evolution. This is just the beginning and start of the method but I am sure there would be large contributions from many other people and hopefully this will become method of choice for densities simulation because it is so fast.

And sorry there were some errors in the latest program I posted and I would be posting another corrected program in two to three days.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

I am sharing this program and this could be a possible starting point for more advanced and precise algorithms. The program works for simple SDEs that do not take auto-correlation structure in integrated variance and you would have to make modifications in this program if you want to simulate mean-reverting or other SDE that take auto-correlation in time though this modification can be easily done. I am sure you would have to modify it for many other SDEs but I hope that it would be useful as a good starting point.
I have simulated the SDE given as
$dX(t)=\mu(t) X(t) dt + \sigma(t) X(t) dz(t)$
The program can take any term structure of volatilities and variable simulation steps. But it simulates one single unique SDE and you would have to make some changes in the program if you want to change the SDE half way along the simulation.
I have used the following simple algorithm to calculate the variance scaling of hermite polynomials.

I have equated the Ito-Taylor simulation method correlated integrated variance with a scaling factor for simulation standard deviation and equated it with uncorrelated true variance of the SDE evolution by altering the scaling factor that makes both sides of the equations equal i.e. this scaling factor equates the integrated variance of the Ito-Taylor density simulation method with the true integrated variance. This is the scaling that is applied to hermite polynomials. In case of auto-correlation in true variance evolution, you would have to account for the autocorrelation effect that I have not done. Here are the equations
if $\sigma_0^2$ is the variance of existing density and $\sigma_1^2$ is the variance of simulation step. Integrated variance of uncorrelated true SDE evolution is on the RHS of the equation below. And Ito-Taylor density simulation method integrated variance is on the LHS of equation below. To the LHS of the equation which is Ito-Taylor density integrated variance, I have applied a scaling denoted by $\rho$ to the simulation step variance (its squre-root) $\sigma_1$ which would equate both sides of the equation.
${\sigma_0}^2 + 2 \sigma_0 (\rho \sigma_1) + {(\rho \sigma_1)}^2 = {\sigma_0}^2 + {\sigma_1}^2$
so we get the equation for rho as
${\rho}^2 + \frac{2 \sigma_0}{\sigma_1} \rho -1=0$
Though we could also calculate absolute variances in normal terms but we just need to find the ratio of standard deviations(meaning square roots of variances) which is done by transforming the densities into normal terms and taking the ratios of both transformed existing density and transformed simulation density subdivision interval.
$\rho = \frac{-b + \sqrt{b^2 +4}}{2}$ where $b= \frac{2 \sigma_0}{\sigma_1}$
rho is the scaling of hermite polynomials that is needed to match the Ito-Taylor simulation method density with true density on each simulation step in time. Again here $\sigma_0$ is square root of variance associated with existing density and $\sigma_1$ is square root of variance associated with simulation step. And this ratio is calculated in "transformed normal density terms" and I would like to compare the normal density transformation as dimensionless-coordinates.
This is b in the above equation where we need to find the ratio of standard deviations.
Here is the matlab program. This is the first quick version and I hope to update it with a better program in a few days.
function [] = ItoTaylorNewWilmottQuadratic03ANew()
%This program simultes the density by making a comparison of
%existing variance of the density and variance to be simulated.
%The Ito-Taylro Density Simulaiton method adjusts the variance
%of hermite polynomials so that simulated variance matches
%with the true integrated variance of the SDE.
%The current program works in the case of SDEs with little
%auto-correlation strucutre across time. So In the case
%of mean-reverting stochastic volatility models or other
%similar models where auto-correlation exists in time,
%the method has to be appropriately modified.
%The first time step is directly simulated
%But for all later steps the variance of hermite
%polynomials is altered so that Ito-Taylor simulation
%method's integrated variance matches the true integrated variance
%The variance is matched by solution of the equation
% sigma1^2 + 2 * sigma1 *(r * sigma2)+ (r * sigma2)^2
%=sigma1^2 + 2 * sigma1 *sigma2+ sigma2^2
%The LHS of the equation is correlated variance
%equation with r which is the scaling factor.
%The RHS of the equation is uncorrelated variance
%evolution which will have to be altered in the
%case of SDEs that take auto-correlation.
% r is the scaling factor that is adjusted so
%that the variance of both sides of the equations are equal
%and this is the scalingfactor that adjusts the
%hermite polynomials's variance
Nn=161;    % No of normal density subdivisions
dNn=.05;   % Normal density width. would change with number of subdivisions
Tt=20;      %No of total simulation time steps;
x0=1.0;   % starting value of SDE
X(1:Nn)=x0; %Initialize the density subdivisions with initial value.
beta1=.55;   % the first drift term power.
gamma=.850;   % volatility power.
mu0=.26;   % first drift coefficient.
dt(1)=.05; %I have kept the time steps the same but you can freely change them.
dt(2)=.05;
dt(3)=.05;
dt(4:Tt)=.065
sigma0(1)=.85;
sigma0(2)=.65;
sigma0(3)=.75;
sigma0(4)=.85;
sigma0(5)=.85;
sigma0(6)=.25;
sigma0(7)=.55;
sigma0(8)=.65;
sigma0(9)=.75;
sigma0(10:Tt)=.95;
T1=1.0;%Hermite polynomials have unit varaince for first step.
for tt=1:Tt

if(tt>1)
tt
NnMid=81; %This is the subdivision used for calculation
%of ratio of standard deviations.
for nn=NnMid-1:NnMid+1
Zn(nn)=((nn-1)*dNn - 4.0);
%This is a training step to calculate a ratio of
%one simulation step volatility of the density and
%volatility of exising density.
%Volatility in above line to be understood as square root of variance
%One step simulation density  is calculated using a
%single starting point of x0
%but you can freely choose any other starting
%point since the variance of transformed normal
%density is independent of the starting coordinates
%though there could be some better starting points
% from the point of view of accuracy.
%This simulation step uses hermite polynomial with standard variance.
%This simulation step is re-started from time zero
%and not on top of existing density. This is just
%to calculate one step variance(or its square root)
%It works since we are calculating the density in
%normal or "dimensionless" coordinates.

X1(nn)=x0+ ...
mu0* x0.^beta1 * dt(tt) + ...
mu0^2 * beta1* x0.^(2*beta1-1) * dt(tt).^2/2.0 + ...
(sigma0(tt) * x0.^gamma *sqrt(dt(tt)) + ...
sigma0(tt) * mu0 * beta1 * x0.^(beta1 + gamma -1) *(1 - 1 / sqrt(3)) * dt(tt).^1.5 + ...
sigma0(tt) * mu0 * gamma * x0.^(beta1 + gamma -1) * 1 / sqrt(3) * dt(tt)^1.5) * Zn(nn) + ...
sigma0(tt).^2 *gamma* x0.^(2*gamma -1 ) .* dt(tt)/2 .* ( Zn(nn).^2 - 1 );

end

%Calculate the start and ends of mid density subdivisions
%y0h and y0l are start and end of mid of existing density
%before the simulation
y0h=X(NnMid)+(X(NnMid+1)-X(NnMid))/2.0;
y0l=X(NnMid)-(X(NnMid)-X(NnMid-1))/2.0;

%y1h and y1l are start and end of mid of density that has been
%simulated to calculate the variance after the simulation
y1h=X1(NnMid)+(X1(NnMid+1)-X1(NnMid))/2.0;
y1l=X1(NnMid)-(X1(NnMid)-X1(NnMid-1))/2.0;

% We calculate the standard deviation ratio after converting both
% densities to normal density after transformation.
% For a single unique SDE, we need to compare just one density subdivison
% and we just compare the ratio of varaince of middle subdivisions
% of existing and simulated training density

SigmaRatio=(2)*(y0h^(1-gamma)-y0l^(1-gamma))/(y1h^(1-gamma)-y1l^(1-gamma))

rho= (-SigmaRatio + sqrt(SigmaRatio^2 + 4))/2.0;
%This rho is scaling of hermite polynomials.

T1=rho^2*(1);
end
for nn=1:Nn
Z(nn)=((nn-1)*dNn-4.0)*sqrt(T1);

HermiteP(1,nn)=1;
HermiteP(2,nn)=Z(nn);
HermiteP(3,nn)=(Z(nn)^2-1);
HermiteP(4,nn)=Z(nn)^3-3*Z(nn);
HermiteP(5,nn)=Z(nn)^4-6*Z(nn)^2+3;

end
for nn=1:Nn
X(nn)=X(nn)+ ...
mu0* X(nn).^beta1 * dt(tt) + ...
mu0^2 * beta1* X(nn).^(2*beta1-1) * dt(tt)^2/2.0 + ...
(sigma0(tt) * X(nn)^gamma *sqrt(dt(tt)) + ...
sigma0(tt) * mu0 * beta1 * X(nn).^(beta1 + gamma -1) *(1 - 1 / sqrt(3)) * dt(tt)^1.5 + ...
sigma0(tt) * mu0 * gamma * X(nn).^(beta1 + gamma -1) * 1 / sqrt(3) * dt(tt)^1.5) * HermiteP(2,nn) + ...
sigma0(tt).^2 *gamma* X(nn).^(2*gamma -1 ) * dt(tt)/2 * HermiteP(3,nn);
end

end
for nn=1:Nn
B(nn)=((nn-1)*dNn-4.0);
end
for nn=2:Nn-1
DfX(nn) = (X(nn + 1) - X(nn - 1))/(B(nn + 1) - B(nn - 1));
end
fX(1:Nn)=0;
for nn = 2:Nn-1
fX(nn) = normpdf(B(nn),0, 1)/abs(DfX(nn));
end
%Monte carlo simulation follows for comparison of our simulated desnsity and
% monte carlo density.
paths=100000;
X2(1:paths)=x0;
Random1(1:paths)=0;
sigma00(1:Tt)=sigma0(1:Tt);
for tt=1:Tt
dt0=dt(tt);
Random1=randn(size(Random1));
X2(1:paths)=X2(1:paths)+ mu0* X2(1:paths).^beta1 *dt0 + ...
sigma00(tt) * X2(1:paths).^gamma .* Random1(1:paths) *sqrt(dt0) + ...
mu0^2 * beta1* X2(1:paths).^(2*beta1-1) *  dt0^2/2.0 + ...
sigma00(tt)^2 * gamma * X2(1:paths).^(2*gamma-1) .* dt0/2.0 .* (Random1(1:paths).^2-1) + ...
mu0 * sigma00(tt) *gamma* X2(1:paths).^(beta1+gamma-1) .* sqrt(1/3) .* dt0^1.5 .* Random1(1:paths) + ...
sigma00(tt) * mu0 *beta1* X2(1:paths).^(beta1+gamma-1) .* (1-sqrt(1/3)) .* dt0^1.5 .* Random1(1:paths);
end
sum(X2(:))/paths   %monte carlo average
BinSize=.0075;
MaxCutOff=20;
[XDensity,IndexOutX,IndexMaxX] = MakeDensityFromSimulation_Infiniti(X2,paths,BinSize,MaxCutOff);
plot(X(3:Nn-2),fX(3:Nn-2),'r',IndexOutX(1:IndexMaxX),XDensity(1:IndexMaxX),'g');
end



Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

Just a warning that for some SDEs and for specific parameters there, the step size that I have used in the above matlab program sometimes might be too large since I am using only two hermite polynomials in the Ito-Taylor density simulation method. It was very easy to write a simple two polynomial simulation program.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

I hope to present a new program in a few days(3-4) based on evolution of the SDEs in transformed coordinates. And here are the key features of the idea behind the new program.
1. Compare the variance by simulating the median of the transformed SDE. Here Z=0 will be used in the simulation and though there will be contributions from the second and fourth hermite polynomials, it will become an ODE like evolution for the median.
2. For appropriate calculation of the variance, I plan to calculate the change of density derivative with respect to Z analytically instead of using finite-differences. Especially at the median, since Z=0, there will only be contribution to this calculated volatility (square-root of variance) only from the terms that take the first power of Z coming from first and third hermite polynomials.

I hope that I will be able to calculate a very good estimate of the variance of the transformed density in new coordinates since a lot of the error that comes from inaccuracies in the numerical method will be controlled when most calculations are analytic and are done using the above features.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

In some of my first Ito-Taylor programs, I calculated the density of SDEs using a change of variable derivative with a standard gaussian density and this change of variable derivative was calculated analytically but later in my programs, I calculated it with finite-differences. Since this derivative is calculated with respect to a standard gaussian variable, it is also directly related with variance.

If the one step second order Ito-Taylor expansion of X(n) which is nth subdivision of the density of X and is given as

$X(n)= a(X_0(n),\Delta t) + b(X_0(n),\Delta t) Z(n) + c(X_0(n),\Delta t) ({Z(n)}^2-1)$

In that case, the local derivative of nth subdivision with respect to Z(n) can be found as

$\frac{dX(n)}{dZ(n)} = b(X_0(n),\Delta t) + 2 c(X_0(n),\Delta t) Z(n)$

And then I calculated the density of X which has been expanded by Ito-Taylor by change of variable with respect to Standard Gaussian density as

$f(X(n)) = f(Z(n)) |\frac{dZ(n)}{dX(n)} |$

but in my later programs, I simply calculated this derivative using finite differences. This derivative is directly related with the variance of the density of the SDE and really should be calculated analytically. In addition to giving us insight about evolution of variance for each subdivision and existing variance for each subdivision, if we calculate this derivative analytically, we will have more precision than using finite-differences version of this derivative. Though obviously, for the calculation of existing variance when dynamics of the evolution are not known or are too complex, we will like to calculate this derivative using finite-differences.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

I think there could be many many new things in stochastics due to new Ito-Taylor related research. Here are a few new opportunities as I can foresee and brainstorming ideas.

1. For modelling and solution of stochastic differential equations, We can very easily modify the existing Ito-Taylor density simulation method to have new stochastic differential equations with time scaling applied to gaussian random variable in the SDE that is different from the time scaling of Brownian motion. This could be very helpful in many stochastic applications.
2. We could easily extend the method and try non-linear version of SDEs where non-linear Guassian noise can for example take a differential of square of Brownian motion, or cube of Brownian motion in the SDE. This is really no more difficult and we can do it just by expanding the non-linear noise in the SDE using Ito formula and then representing every resulting integral in terms of integrals of hermite polynomials and then further expand those integrals using Ito-Taylor logic. Here is a relevant earlier post that I made in which I tried to show how integrals containing powers of Brownian motion can easily be represented in terms of hermite polynomials.
Amin:
Here I have latexed the update formulas for stochastic integrals
$\int_0^t s^m H_{n}(z(s)) ds = \frac {t^{m+1} H_{n}(z(t))}{(m+1)} (1 - \frac {\sqrt{n}}{\sqrt{(2m+n+2)}})$
$\int_0^t s^m H_{n}(z(s)) dz(s)= \frac {t^m H_{n+1}(z(t))}{ \sqrt{(n+1)} \sqrt{(2m+n+1)}}$
As I suggested, we can calculate most stochastic integrals using this update. Let us suppose, we want to calculate
$\int_0^t z(s)^4 ds$  Equation(1)
Here is the way to go. We have to do it in terms of hermite polynomials.
fourth hermite polynomial representation of Brownian motion goes like
$H_4(z(t)) = z(t)^4 -6 t z(t)^2 +3 t^2$  Eq(2)
and second hermite polynomial is
$H_2(z(t)) = z(t)^2 - t$  Eq(3)
and we know from the quoted post
$\int_0^t H_4(z(s)) ds = t H_4(z(t)) (1- \frac{2}{\sqrt{6}} )$  Eq(4)
so from Eq(2) and Eq(4)
$\int_0^t z(s)^4 ds = t H_4(z(t)) (1 - \frac{2}{\sqrt{6}} ) + 6 \int_0^t s z(s)^2 ds - 3 \int_0^t s^2 ds$ Eq(5)
In order to solve the second term, we take the second hermite polynomial and use the formula in quotes to calculate that
$\int_0^t s H_2(z(s)) ds = \frac{t^2 H_2(z(t))}{2} (1 - \frac{\sqrt{2}}{\sqrt{6}} )$  Eq(6)
so
$\int_0^t s z(s)^2 ds = \frac{t^2 H_2(z(t))}{2} ( 1 - \frac{\sqrt{2}}{\sqrt{6}} ) + \int_0^t s^2 ds$  Eq(7)
and we substitute Eq(7) in Eq(5) to get
$\int_0^t z(s)^4 ds = t H_4(z(t)) ( 1 - \frac{2}{\sqrt{6}} ) + 3 t^2 H_2(z(t)) ( 1 - \frac{\sqrt{2}}{\sqrt{6}} ) + 3 \int_0^t s^2 ds$
so
$\int_0^t z(s)^4 ds = t H_4(z(t)) (1- \frac{2}{\sqrt{6}} ) + 3 t^2 H_2(z(t)) ( 1 - \frac{\sqrt{2}}{\sqrt{6}} ) + t^3$
and we could take $t^3$ common and have a representation in terms of standard normal. And then you can easily simulate the density of $\int_0^t z(s)^4 ds$ or analytically calculate and plot its density.
3. It would also be interesting how we could solve Jump-diffusion SDEs by calculating the variance of Jump parts of the SDEs and adding it to Ito-Taylor density simulation method on every step.
4. We could try other noises different from Gaussian noise. Very simple starting point could be noises for whose densities we already know other orthogonal polynomials just like hermite polynomials are orthogonal with respect to Gaussian density.
So I really believe there would be huge new avenues for people doing research in stochastics and their applications and we would be able to apply stochastics to model many complex phenomenon more easily.

Last edited by Amin on August 27th, 2018, 8:35 pm, edited 2 times in total.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

I would like to mention for friends again that Ito-Taylor expansion theory of SDEs was originally developed by Dr. Eckhard Platen and Dr. Wolfgang Wagner. Here are two first original papers in this area.
1. A Generalized Taylor Formula for Solutions of Stochastic Equations. By Eckhard Platen.
2. On a Taylor Formula for a Class of Ito Processes. By Eckhard Platen and Wolfgang Wagner.

Though it is popularly called Ito-Taylor expansion, it has also been called Platen and Wagner formula at many places in the literature acknowledging the original work of Platen and Wagner.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

When we simulate a simple SDE of the form
$dX(t)=\sigma(t) dz(t)$
for two steps with volatility for individual steps given as $\sigma(t_1)$  and $\sigma(t_2)$
The true integrated variance over time is known obviously as ${\sigma(t_1)}^2 \Delta(t_1) + \sigma(t_2)^2 \Delta(t_2)$
But in the Ito-Taylor density simulation method, the integrated variance is correlated with previous time steps for each time step in time evolution and when we use a hermite polynomial with unit variance for two step simulation, the integrated variance of the density with two step evolution is given as
${\sigma(t_1)}^2 \Delta(t_1) + 2 \sigma(t_1) \sqrt{\Delta(t_1)} \sigma(t_2) \sqrt{\Delta(t_2)} +{\sigma(t_2)}^2 \Delta(t_2)$
Now all friends can see why in the Ito-Taylor density simulation method programs I posted for various SDEs with time homogeneous variance structure and for T step simulation when I used $\frac{1}{\sqrt{T}}$, my variance was matching with true variance since it divided the correlated integrated variance (of the Ito-Taylor density simulation method) by a factor of T and brought it equal to true uncorrelated integrated variance in time.
So we have to design all Ito-Taylor density simulation methods considering that unlike monte carlo integrated variance is no-longer uncorrelated in time in this Ito-Taylor density simulation method and we would have to match integrated variance on each step of the density evolution. This is just the beginning and start of the method but I am sure there would be large contributions from many other people and hopefully this will become method of choice for densities simulation because it is so fast.

And sorry there were some errors in the latest program I posted and I would be posting another corrected program in two to three days.
I believe that the statement made in the above post is true only when first hermite polynomials are involved. And the density simulation laws over the time grid would be different and more complex as we add higher hermite polynomials in Ito-Taylor density simulation algorithm. And since the above holds for only first hermite polynomials and that is one reason when we convert the SDE into gaussian-like coordinates and most of the variance is explained by the first hermite polynomial in transformed coordinates, we can easily use the hermite polynomial variance scaling formula that is based on the above post. But I am sure we are not limited to using that formula based on gaussian-like coordinates and I would soon be posting a new program for SDE evolution that would advance the density using original coordinates and that would be based on how higher hermite polynomials interact when we use Ito-Taylor desnity evolution algorithm though I am afraid that some equations that would have to be solved would be more difficult than the simple quadratic equation we needed to solve when we made the variance calculations in the gaussian-like transformed coordinates.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

In the old program that I shared that demonstrated that the new method is indeed useful, I simply took a transformation of the SDE variable and compared existing and new variances by taking a ratio of subdivision widths in transformed variables. This was a quick hack and works remarkably well. But has problems when SDEs become non-linear like stochastic  volatility SDEs and when diffusion starts too close to zero. In an ideal sense, the existing and new variances of transformed variables have to be compared in terms of variance of Bessel process. I am working on it but since the process has to be fast, it would require a bit of effort as we do not want any large calculations that would slow down the method. We have to match existing variance with the variance of Bessel process for the same probability quantile and same for the new variance. I hope that I would be able to complete this in next few days and post a simple routine here on Wilmott technical forum.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

OK here is my initial strategy to map the volatility on a CEV type diffusion. Sankaran's approximation maps the CDF of CEV variable on the CDF of normal variable. This is very similar to CDF subdivisions we have in our method. Using Sankaran's approximation, we can easily numerically calculate the value of $\frac{\partial F}{\partial Z}$ and by perturbing these derivatives, we can calculate the values of $\frac{\partial \frac{\partial F}{\partial Z}}{\partial \big[{\sigma}^2 t \big]}$. In fact $\frac{\partial F}{\partial Z}$ is an even cheaper and better proxy for the width of the subdivisions and is found by finite differences on subdivision centers. And we will have to do a newton type iteration to match and find a pair of $\frac{\partial F}{\partial Z}$ and ${\sigma}^2 t$ from the Sankaran formula to find the variance in driftless CEV units. This should be fairly easy. I have not done this yet but I will be playing with it in next few days. And if it goes well, something faster might possibly be worked out. I believe we could map different subdivisions of non-linear SDEs on respective sub divisions of CEV process to find the variance of various subdivisions of non-linear subdivisions in driftless CEV units. Again I have not done this so I would request friends to take this with a grain of salt.
Word of caution is that this is for researchers only and not everybody is advised to start working with this until there is a completely clear recipe to follow.

Amin
Topic Author
Posts: 2145
Joined: July 14th, 2002, 3:00 am

Re: Breakthrough in the theory of stochastic differential equations and their simulation

I am sharing this program and this could be a possible starting point for more advanced and precise algorithms. The program works for simple SDEs that do not take auto-correlation structure in integrated variance and you would have to make modifications in this program if you want to simulate mean-reverting or other SDE that take auto-correlation in time though this modification can be easily done. I am sure you would have to modify it for many other SDEs but I hope that it would be useful as a good starting point.
I have simulated the SDE given as
$dX(t)=\mu(t) X(t) dt + \sigma(t) X(t) dz(t)$
The program can take any term structure of volatilities and variable simulation steps. But it simulates one single unique SDE and you would have to make some changes in the program if you want to change the SDE half way along the simulation.
I have used the following simple algorithm to calculate the variance scaling of hermite polynomials.

I have equated the Ito-Taylor simulation method correlated integrated variance with a scaling factor for simulation standard deviation and equated it with uncorrelated true variance of the SDE evolution by altering the scaling factor that makes both sides of the equations equal i.e. this scaling factor equates the integrated variance of the Ito-Taylor density simulation method with the true integrated variance. This is the scaling that is applied to hermite polynomials. In case of auto-correlation in true variance evolution, you would have to account for the autocorrelation effect that I have not done. Here are the equations
if $\sigma_0^2$ is the variance of existing density and $\sigma_1^2$ is the variance of simulation step. Integrated variance of uncorrelated true SDE evolution is on the RHS of the equation below. And Ito-Taylor density simulation method integrated variance is on the LHS of equation below. To the LHS of the equation which is Ito-Taylor density integrated variance, I have applied a scaling denoted by $\rho$ to the simulation step variance (its squre-root) $\sigma_1$ which would equate both sides of the equation.
${\sigma_0}^2 + 2 \sigma_0 (\rho \sigma_1) + {(\rho \sigma_1)}^2 = {\sigma_0}^2 + {\sigma_1}^2$
so we get the equation for rho as
${\rho}^2 + \frac{2 \sigma_0}{\sigma_1} \rho -1=0$
Though we could also calculate absolute variances in normal terms but we just need to find the ratio of standard deviations(meaning square roots of variances) which is done by transforming the densities into normal terms and taking the ratios of both transformed existing density and transformed simulation density subdivision interval.
$\rho = \frac{-b + \sqrt{b^2 +4}}{2}$ where $b= \frac{2 \sigma_0}{\sigma_1}$
rho is the scaling of hermite polynomials that is needed to match the Ito-Taylor simulation method density with true density on each simulation step in time. Again here $\sigma_0$ is square root of variance associated with existing density and $\sigma_1$ is square root of variance associated with simulation step. And this ratio is calculated in "transformed normal density terms" and I would like to compare the normal density transformation as dimensionless-coordinates.
This is b in the above equation where we need to find the ratio of standard deviations.
In many non-linear equations, it might not be possible to assign a single scaling $\rho$ to the variance along all subdivisions for a single SDE. And we could have a different scaling applied to hermite polynomials $\rho(n)$ for nth subdivision. Another simple way for finding $b(n)=\frac{ 2 \sigma_0(n)}{\sigma_1(n)}$ would be to simply use the basic formula of variance and use the formula $b(n)=\frac{2 (x_n(t)-\mu(t))}{(x_n(t,t+1)-\mu(t,t+1)}$. Here $x_n(t)$ is the center of the nth subdivision on the existing density and $\mu(t)$ is the mean of the existing density while $x_n(t,t+1)$ is the center of nth subdivision on one step evolved density that is evolved from the mean $\mu(t)$ of the existing density and $\mu(t,t+1)$ is the mean of the new one step evolved density.
I wanted to post a program with this formula but there was a problem that close to the means in the equation for $b(n)$, the values become unstable or off and I have to account for this instability and fix it otherwise this formula works remarkably well once a bit away from the means. Again this formula has to be applied to transformed coordinates as I did in the first program.