## Euler scheme for coinitial swap rates

Discuss code issues here

### Euler scheme for coinitial swap rates

Hi all,

reading the paper from Joshi, Yang (2009) I decided to implement the algorithm suggested for the Euler drift freezing scheme. But it won't work when I compare my results with the ones provided in table 3.1.

Here is the Matlab code: it retrieves all the parameters we need to implement the step. I use initial suggested correlation matrix and displacement coefficients.

Code: Select all
`function [barA, a, mu]=fun(SR)% From a state of the vector SR_1,... SR_10 we find the parameters% barA = discounted annuities, a=pseudo-square root of Cov, mu=driftsrho=zeros(10);mu=zeros(1,10);for i=1:10    for j=1:10        rho(i,j)=exp(-0.05*abs(i-j));    endend%IV=csvread('IV.csv');%alpha=csvread('alpha.csv');IV=.2; %alpha=.02*ones(1,10); %displacements all set at 2%          sigma=zeros(1,10); %this is sigma^alpha for i=1:10    sigma(i)=IV*SR(i)/(SR(i)+alpha(i)); %Rebonato approximationendcovmat=diag(sigma)*rho*diag(sigma); %this is where  I could be wronga=chol(covmat)'; %pseudo square root..P=zeros(1,10); %bond prices deflated by P0barA=zeros(1,10); for i=1:10    if i==1        aaa=0;    else        aaa=barA(i-1);    end    P(i)=(1-SR(i)*aaa)/(1+SR(i)); %formula (2.10)    barA(i)=aaa+P(i);  %(2.8)endcv=zeros(10); %cv(i,j)= cross variation Z_k, A_jfor k=1:10    for i=1:10        if i==1            aaa=0;        else            aaa=cv(k,i-1);        end        temp=aaa-a(i,k)*(SR(i)+alpha(i))*barA(i); %(2.6)        cv(k,i)=temp/(1+SR(i));    endend`

the step itself is done like

Code: Select all
`function SR=step(S) %we implement the formula (2.11)SR=S;alpha=0.02*ones(1,10);[barA,a,mu]=fun(S);Z=randn(1,10);for i=1:10    temp=0;        for k=1:10        temp=temp+a(i,k)*Z(k)-a(i,k)^2/2;    end        SR(i)=(S(i)+alpha(i))*exp(mu(i)+temp)-alpha(i);end`
stochan

Posts: 4
Joined: Thu Aug 23, 2012 7:44 am

### Re: Euler scheme for coinitial swap rates

Any clue on why it is not working?
stochan

Posts: 4
Joined: Thu Aug 23, 2012 7:44 am

### Re: Euler scheme for coinitial swap rates

i can't go through code
mj

Posts: 1380
Joined: Fri Jul 27, 2007 7:21 am

### Re: Euler scheme for coinitial swap rates

If I want to work as a quant, can you please rank New York, London, Singapore and Sydney in terms of:
(1) Buiding attractive experience on the cv.
(2) Salary level.
(3) Future job growth opportunity.
coool
coool12

Posts: 1
Joined: Thu Nov 29, 2012 4:50 am

### Re: Euler scheme for coinitial swap rates

ask in the careers forum not on a trhead in the code forum
mj

Posts: 1380
Joined: Fri Jul 27, 2007 7:21 am

### Re: Euler scheme for coinitial swap rates

mj wrote:ask in the careers forum not on a trhead in the code forum

You are right.
Garret2
Garret2

Posts: 2
Joined: Tue Jan 08, 2013 4:42 am