# Quasi Monte Carlo method and Heston model

I want to run a quasi monte carlo simulation for Heston model in matlab. Obviously there exists a lot of literature regarding the theoretical aspects of the topic, for example by Baldeaux and Roberts, 2012. Although I studied their work carefully I can't solve my problem: For the simulation of the dynamics of the stock price and the volatility I need two correlated normally distributed random variables. Currently I generate a halton set, scramble the halton set and use the function qrandstream to construct a quasi-random number stream. Two points from this stream are used to generate the correlated and normally distributed random numbers I need. The resulting stock price ist too high and even increases further with increasing number of simulation runs. I am sure that the reason for this unwanted behaviour is some correlation in the quasi random series I use, probably between the dimensions of the halton set.

Can someone advise me how to use quasi random numbers in matlab for heston model?

Below you can see my code.

Thanks for the help!

Paul

    function [price, err] = Heston_MCS_Euler(S,K,T,r,v,kappa,theta,lambda,sigma,rho,N,M,)

kappa_s=kappa+lambda;
theta_s=kappa*theta/(kappa+lambda);
dt=T/N;
C=zeros(M,1);

p = haltonset(2,'Skip',1e3,'Leap',1e2);
p = scramble(p,'RR2');
q = qrandstream(p);

for j=1:M
S_m=zeros(N+1,1);
v_m=zeros(N+1,1);
S_m(1)=S;
v_m(1)=v;

for i=1:N
point = qrand(q,1);
%convert to normal distribution by norminv
e1=norminv(point(1),0,1);
e2_temp=norminv(point(2),0,1);
e2=e1*rho+e2_temp*sqrt(1-rho*rho);
%euler discretization
S_m(i+1)=S_m(i)*exp((r-0.5*max(v_m(i),0))*dt+sqrt(max(v_m(i),0))*sqrt(dt)*e1);
v_m(i+1)=v_m(i)+kappa_s*(theta_s-max(v_m(i),0))*dt+sigma*sqrt(max(v_m(i),0))*sqrt(dt)*e2;
end

C(j)=exp(-r*T)*max(S_m(N+1)-K,0);

end

price=mean(C);
err=std(C)/sqrt(M);
end

• did you check convergence using a pseudo random generator, just to make sure the problem lies with the quasi random generator ? Also the line C(j)=exp(-r*T)*max(S_m(N+1)-K,0); should not be within the for i loop – Antoine Conze Mar 6 '18 at 13:56
• Hi Antoine, thanks for your remark. I have tried the code with pseudo random number and it worked well which is why I am sure there is some problem with the quasi random numbers. – Paul Mar 6 '18 at 16:41
• could you resolve this? (facing the same problem) :) – Vanity Jun 10 '18 at 22:18