- Cuchulainn
**Posts:**60444**Joined:****Location:**Amsterdam-
**Contact:**

No problem.

http://www.datasimfinancial.com

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

QuoteOriginally posted by: list1It might be I am wrong but let check your approximation in a trivial case [$]\mu\,=\, 0\, , \, \sigma\,=\,1[$] and t = 10.Your eq eq should be of the type[$] x \,(\, 10\, ) \,=\, x \,(\, 0\, ) \,+ \int_0^{10}\,dz\,(\,s\,)\,\,=\,\, x \,(\, 0\, ) \,+ \,z\,(\,10\,) [$]Can we apply your formulas to present approximation of the x ( 10 ) ?

- Cuchulainn
**Posts:**60444**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: list1QuoteOriginally posted by: list1It might be I am wrong but let check your approximation in a trivial case [$]\mu\,=\, 0\, , \, \sigma\,=\,1[$] and t = 10.Your eq eq should be of the type[$] x \,(\, 10\, ) \,=\, x \,(\, 0\, ) \,+ \int_0^{10}\,dz\,(\,s\,)\,\,=\,\, x \,(\, 0\, ) \,+ \,z\,(\,10\,) [$]Can we apply your formulas to present approximation of the x ( 10 ) ?How does this compare against solution using Ito formula? ====Kloeden and Platen have a bunch of explicitly solvable SDE pages 118-126.

Last edited by Cuchulainn on April 19th, 2016, 10:00 pm, edited 1 time in total.

http://www.datasimfinancial.com

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

For your example there is also a handy exact integral: \[\int_0^t z_t dz_t=\frac{1}{2}(z_t^2-t)\], so you may want to explain how/if your result agrees with it...

Last edited by amike on April 19th, 2016, 10:00 pm, edited 1 time in total.

QuoteOriginally posted by: list1QuoteOriginally posted by: list1It might be I am wrong but let check your approximation in a trivial case [$]\mu\,=\, 0\, , \, \sigma\,=\,1[$] and t = 10.Your eq eq should be of the type[$] x \,(\, 10\, ) \,=\, x \,(\, 0\, ) \,+ \int_0^{10}\,dz\,(\,s\,)\,\,=\,\, x \,(\, 0\, ) \,+ \,z\,(\,10\,) [$]Can we apply your formulas to present approximation of the x ( 10 ) ?My idea was for the explicit exact function x ( 10 ) given above to apply Amin's formulas. It should be first whether these formulas are correct. Second as Amin's formulas contained z ( 0 ) that probably is equal to 0 if z is a Wiener process then the same type of approximation on [ 5 , 10 ] with x ( 5 ) as initial data present better approximation of x ( 10 ) value of original eq (1). This observation suggests that in case if formulas are correct to use partition of the [ 0 , T ] and apply Amin's formulas on each subinterval. When the length of max interval tends to 0 we should arrive at exact solution. In original scheme formulas are attached to the interval [ 0 , t ], t > 0. It is difficult to call it approximation as there is there is no parameter which specifies convergence approximation to exact sde solution. Situation is similar to say y = sin x and y = [$]x^3[$] on [ - 1 , 1 ]. These are different functions though on a small interval [ - h , h ] one can be considered as an approximation of other.

QuoteOriginally posted by: list1QuoteOriginally posted by: list1QuoteOriginally posted by: list1It might be I am wrong but let check your approximation in a trivial case [$]\mu\,=\, 0\, , \, \sigma\,=\,1[$] and t = 10.Your eq eq should be of the type[$] x \,(\, 10\, ) \,=\, x \,(\, 0\, ) \,+ \int_0^{10}\,dz\,(\,s\,)\,\,=\,\, x \,(\, 0\, ) \,+ \,z\,(\,10\,) [$]Can we apply your formulas to present approximation of the x ( 10 ) ?My idea was for the explicit exact function x ( 10 ) given above to apply Amin's formulas. It should be first whether these formulas are correct. Second as Amin's formulas contained z ( 0 ) that probably is equal to 0 if z is a Wiener process then the same type of approximation on [ 5 , 10 ] with x ( 5 ) as initial data present better approximation of x ( 10 ) value of original eq (1). This observation suggests that in case if formulas are correct to use partition of the [ 0 , T ] and apply Amin's formulas on each subinterval. When the length of max interval tends to 0 we should arrive at exact solution. In original scheme formulas are attached to the interval [ 0 , t ], t > 0. It is difficult to call it approximation as there is there is no parameter which specifies convergence approximation to exact sde solution. Situation is similar to say y = sin x and y = [$]x^3[$] on [ - 1 , 1 ]. These are different functions though on a small interval [ - h , h ] one can be considered as an approximation of other.I have presented a graphical comparison of two densities. One derived by short stepping monte carlo and the other derived from one step monte carlo. I am a bit busy, so I cannot spare time to give anything better at the moment. It should be enough to tell you, if you play with the program, how good my method is. If there is a mismatch between densities, it is mostly due to problems with short-stepping traditional monte carlo. If you graph densities of sin(x) and x3, you should be able to detect the difference if you are smart enough. As I said, this is the best I can do today to set up a small simulation of two densities for you so you can compare for yourself.

Last edited by Amin on April 19th, 2016, 10:00 pm, edited 1 time in total.

For the interest of friends I will post slightly modified version of the previous program that computes the integral of tzdz or t(z-z0)dz by putting z0=0. If my one step method has a different shape, it is more accurate than the shape of density from very short stepping method. You can look at mean and second moment numbers that they match very well. You will need the helper matlab function from previous post to plot the density. I will be posting a full fledged simulation of CEV model option pricing program in 2-4 days. function [] = SDE_Compare_Zintegrals_Infiniti_public02( ) s1 = RandStream('mt19937ar');RandStream.setDefaultStream(s1);savedState = s1.State; z0=4;%z0=0;%z0=10;%z0=.5;sigma0=.710/2;%sigma0=0.710/4%sigma0=0.710*4T_index=400;% 00; %T_index=2000; %T_index=20; dt=.005/1.0;T=(T_index)*dt;paths=1000000; zz(1:paths)=z0; I2(1:paths)=0.0;%integral tzdz over time by traditional short stepped monte carlo. zzT(1:paths)=0.0;%One step integral tzdz calculated by my method for nn=1:T_index %Loop over time.t=(nn)*dt; t2=(nn-1)*dt; Random1=randn(size(zz)); RandTemp1=Random1.*sqrt(dt);I2=I2+t2*(RandTemp1*sigma0).*(zz);zz = zz +RandTemp1*sigma0;end%My One Step method calculation startsRandom1=randn(size(zzT)); zzT=z0*sigma0.*Random1*T.^1.5*.5760+...sigma0.^2* Random1.^2.*T.^2*sqrt(2).*(1/4)-....5*sigma0.^2.*T.^2*(1/2)*sqrt(2);I2_avg=sum(I2)./pathszzT_avg=sum(zzT)./pathsI2_avg2=sum(abs(I2))./pathszzT_avg2=sum(abs(zzT))./paths%%Below are second moments. To see if both are matchedI2_var=sum(I2.^2)./pathszzT_var=sum(zzT.^2)./pathsBinSize=.01;%Here you can change the resolution of monte carlo density. You might have to look at the graph and if it is jagged and noisy, increase the bin sizeMaxCutOff=1000;%Max cut off is a value given to density generation program. [XDensity,IndexOutX,IndexMaxX] = MakeDensityFromSimulation_Infiniti(I2,paths,BinSize,MaxCutOff );[XDensity2,IndexOutX2,IndexMaxX2] = MakeDensityFromSimulation_Infiniti(zzT,paths,BinSize,MaxCutOff );plot(IndexOutX(1:IndexMaxX),XDensity(1:IndexMaxX),'g',IndexOutX2(1:IndexMaxX2),XDensity2(1:IndexMaxX2),'r')str=input('look at overlaid Graph comparison of traditional Monte carlo density of zdz(green line) with density of SDE generated from one step monte carlo method(red line)>');end

Last edited by Amin on April 22nd, 2016, 10:00 pm, edited 1 time in total.

Though I just gave a detailed scheme for a double nested dz integral, many intelligent and smart mathematicians would have guessed that a doubly nested dz integral can be described in terms of hermite polynomials of degree up to 2 and similarly the integrals with nesting degree 3 could be described in terms of hermite polynomials of degree three and less and so on for higher degree of nesting. Of course, you have to make adjustments due to volatility and time multipliers that affect the total variance.

Last edited by Amin on April 23rd, 2016, 10:00 pm, edited 1 time in total.

For a reference to above formulas with nested dz-integrals when you have calculated the appropriate variance, you can calculate them by a slight modification after following the reference below."Brownian Motion and Stochastic Calculus" by Karatzas and Shreve. You have to follow the Exercise 3.31 on page 167.

Last edited by Amin on April 23rd, 2016, 10:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**60444**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: AminFor a reference to above formulas with nested dz-integrals when you have calculated the appropriate variance, you can calculate them by a slight modification after following the reference below."Brownian Motion and Stochastic Calculus" by Karatzas and Shreve. You have to follow the Exercise 3.31 on page 167.This is a well-known technique in engineering.. the book by Ghanem and Spanos expands on this topic.On a related topic, instead of integral we can use Karhunen Loeve expansion and transform SDE into a random ODE. I have discretize eq (6) by hand (predictor correct as in Kloeden+Platen) and using the Boost ODE solver in combination with Monte Carlo. I get results that are better than the known FD schemes for SDE.RODEThe point is that the uncountable measure space has been replaced by a countable(and then truncated) Fourier expansion in eqs. (2) and (26). N.B. we have to solve it as a Stratonovich corrected drift function.

Last edited by Cuchulainn on April 23rd, 2016, 10:00 pm, edited 1 time in total.

http://www.datasimfinancial.com

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

Cuch, you are right. How well known the techniques is in applied literature, I do not know but if you read my first post in the thread, you will realize that we can do a much high order monte carlo than existing practices. Most of the integrals involve simple and basic arithmetic with a minor application of integral calculus. If you take high enough order in expansion of drift and volatility part of SDE, you could do a 5yr monte carlo with desired accuracy in just one step. In the context of my first post, this technique has never been applied to monte carlo before. My upcoming paper also has a portion devoted to very interesting applications of Girsanov theorem to non-linear SDEs with drift.

Last edited by Amin on April 23rd, 2016, 10:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**60444**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: AminCuch, you are right. How well known the techniques is in applied literature, I do not know but if you read my first post in the thread, you will realize that we can do a much high order monte carlo than existing practices. Most of the integrals involve simple and basic arithmetic with a minor application of integral calculus. If you take high enough order in expansion of drift and volatility part of SDE, you could do a 5yr monte carlo with desired accuracy in just one step. In the context of my first post, this technique has never been applied to monte carlo before. My upcoming paper also has a portion devoted to very interesting applications of Girsanov theorem to non-linear SDEs with drift.Amin,Unfortunately, I don't speak Matlab, so I will need to rely on a math/pseudo-code for the algorithm. I would say write up the stuff _in detail_ so that we can all have a go (writing Matlab does not count).thanks

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

Ok Cuch, I will try to write a C++ code for you because that is what I will do myself finally. A word of caution, Karatzas and Shreve reference I mentioned will have to be slightly modified but you could see that different nested integrals in our case remain orthogonal to each other which is probably the only requirement for a general application.

- Cuchulainn
**Posts:**60444**Joined:****Location:**Amsterdam-
**Contact:**

Ok, but a precise description of the algorithm is enough.

http://www.datasim.nl

Approach your problem from the right end and begin with the answers. Then one day, perhaps you will find the final question..

R. van Gulik

QuoteOriginally posted by: CuchulainnOk, but a precise description of the algorithm is enough.Yes, I will try to explain that in detail.QuoteOriginally posted by: AminA word of caution, Karatzas and Shreve reference I mentioned will have to be slightly modified but you could see that different nested integrals in our case remain orthogonal to each other which is probably the only requirement for a general application.Friends can notice that right hand side of multiple Ito integral computation is independent of t1, t2, .., tn-1 and dMt1, dMt2, dMt3,.. and only depends on t and Mt. Our integrals are also orthogonal. for example in the integral [$]\int _0^t s \text{$\sigma $dz}(s)\int _0^s \text{$\sigma $dz}(u)[$] the part [$]s \text{$\sigma $dz}(s)[$] is orthogonal to [$] \int _0^s \text{$\sigma $dz}(u)[$] and so on for any degree of nesting. Just as dz(s) is orthogonal to z(s).

Last edited by Amin on April 24th, 2016, 10:00 pm, edited 1 time in total.

GZIP: On