Calibration of The Vasicek Model PDF
Calibration of The Vasicek Model PDF
Calibration of The Vasicek Model PDF
Victor Bernal A.
victor.bernal@mathmods.eu
Abstract
In this report we present 3 methods for calibrating the OrnsteinUhlenbeck process to a data set. The
model is described and the sensitivity analysis with respect to changes in the parameters is performed.
In particular the Least Squares Method, the Maximum Likelihood Method and the Long Term Quantile
Method are presented in detail.
Introduction
The OrnsteinUhlenbeck process [3] (named after Leonard Ornstein and George Eugene Uhlenbeck), is a
stochastic process that, over time, tends to drift towards its long-term mean: such a process is called mean-
reverting. It can also be considered as the continuous-time analogue of the discrete-time AR(1) process where
there is a tendency of the walk to move back towards a central location, with a greater attraction when the
process is further away from the center.
Vasicek assumed that the instantaneous spot Interest Rate under the real world measure evolves as an Orstein-
Uhlenbeck process with constant coecients [5]. The most important feature which this model exhibits is the
mean reversion,which means that if the interest rate is bigger than the long run mean µ, then the coecient
λ makes the drift become negative so that the rate will be pulled down in the direction of µ. Similarly, if the
interest rate is smaller than the long run mean. Therefore, the coecient λ is the speed of adjustment of the
interest rate towards its long run level. This model is of particular interest in nance because there are also
compelling economic arguments in favor of mean reversion. When the rates are high, the economy tends to
slow down and borrowers require less funds. Furthermore, the rates pull back to its equilibrium value and
the rates decline. On the contrary when the rates are low, there tends to be high demand for funds on the
part of the borrowers and rates tend to increase. One unfortunate consequence of a normally distributed
interest rate is that it is possible for the interest rate to become negative.
In this article we start from the Euler Maruyana discretization scheme for the Vasicek process and the
sensitivity analysis, then we present in detail 3 well known methods (Least squares Method, Maximum
Likelihood Method and the Long Term Quantile Method) for calibrating the model's parameter to a data
set. We also refer the reader to [4] where some of these techniques are applied but using a dierent scheme.
ˆt
rt = r0 exp (−λt) + µ (1 − exp (−λt)) + σ exp (−λt) dWt (1.2)
0
Here the interest rates are normally distributed and the expectation and variance are given by
1
Eo [rt ] = r0 exp (−λt) + µ (1 − exp (−λt)) (1.3)
and
σ2
V ar [rt ] = (1 − exp (−2λt)) (1.4)
2λ
σ2
as t → ∞, the limit of expected rate and variance, will converge to µ and 2λ respectively. The Euler
Maruyana Scheme for this models is
√
rt+δt = rt + λ (µ − rt ) δt + σ δtN (0, 1) (1.5)
the process can go negative with probability
√
P (rt+δt ≤ 0) = P rt + λ (µ − rt ) δt + σ δtN (0, 1) ≤ 0 (1.6)
rt + λ (µ − rt ) δt
= P N (0, 1) ≤ − √ (1.7)
σ δt
rt + λ (µ − rt ) δt
=Φ − √ (1.8)
σ δt
Some of the parameters play a big role in the pricing of a nancial derivatives or in the forecasting of a process,
while some of them do not aect them so much. Therefore, depending on what we want to price or forecast,
it is important to check the sensitivity of the models with respect to dierent parameters. The corresponding
sensitivity analysis is performed as presented in [6]. Lets consider a two outcomes of a process which dier
exclusively in a perturbation of one of the parameters (but they have the same stochastic realization N (0, 1)),
then for λ we have that
√
r̃t+δt = rt + [λ + ∆λ] (µ − rt ) δt + σ δtN (0, 1) (1.9)
so
r̃t+δt − rt+δt = ∆λ (µ − rt ) δt (1.10)
when λ is increased the variance (1.4) decreases. So, the change in the reversion coecient will not aect
the short rate (1.3) in long term, just eect the time which is necessary for the interest rate to come back to
the long term mean. Therefore, λ is important in the pricing of the nancial instruments which are aected
by the volatility (1.4), but are not dependent on the long term expected value (1.3) of the simulated interest
rate. For µ is performed as
√
r̃t+δt = rt + λ ([µ + ∆µ] − rt ) δt + σ δtN (0, 1) (1.11)
so
2
Vasicek Process
0.9
0.8
0.7
0.6
Interest rate
0.5
0.4
0.3
0.2
0.1
0 20 40 60 80 100
time
rng ( 1 2 3 )
%% Parameters o f t h e Model
lambda = 0 . 3 ;% R e v e r t i o n c o e f f i c i e n t
N=3; % Number o f s i m u l a t i o n s
mu= 0 . 7 ; % Long term Mean
sigma = 0 . 0 5 ; % V o l a t i l i t y
d e l t a _ t =1; % Time s t e p
T=100; % Time l e n g h t
c o l o r =[ ' b ' , ' r ' , 'm' ] ; % c o l o r
n=T. / d e l t a _ t ; % Number o f time s t e p s
j =1;
The relationship between consecutive observations rt+δt and rt is linear with a iid normal random term
3
Least Squares Fitting
1
0.9
0.8
0.7
0.6
ri+1
0.5
0.4
0.3
0.2
0.1
0.4 0.5 0.6 0.7 0.8 0.9 1
ri
b = λµδt (2.5)
√
= σ δtN (0, 1) (2.6)
where using a least squares tting as described in the Appendix.
n
n n
1
P P P
(ri+1 ri ) − n ri ri+1
â = i=1 n ni=1 ni=1 (2.7)
P 2 1 P P
ri − n ri ri
i=1 i=1 i=1
and
n n
!
1 X X
b̂ = ri+1 − ari (2.8)
n i=1 i=1
so we can estimate the model's parameters as
1−a
λ= (2.9)
δt
b
µ= (2.10)
1−a
V ar ()
σ2 = (2.11)
δt
we refer the reader to the Appendix (4) where the derivation and the implemented code is presented.
4
Random Noise
0.1
0.08
0.06
0.04
0.02
Noise
0
−0.02
−0.04
−0.06
−0.08
1
Time
n
" #
2
X 1 [ri − (ri−1 + λ (µ − ri−1 ) δt)]
= ln √ exp − (3.3)
i=1 2πσ 2 δt 2σ 2 δt
n 2
X 1 [ri − (ri−1 + λ (µ − ri−1 ) δt)]
= ln √ − (3.4)
i=1 2πσ 2 δt 2σ 2 δt
h√ i−n X n 2
[ri − (ri−1 + λ (µ − ri−1 ) δt)]
= ln 2πσ 2 δt − 2
(3.5)
i=1
2σ δt
obtaining
n 2
n X [ri − (ri−1 + λ (µ − ri−1 ) δt)]
L=− ln 2πσ 2 δt − (3.6)
2 i=1
2σ 2 δt
using the procedure described in the Appendix (4) the parameters are estimated giving
n
1 X ri − ri−1 (1 − λδt)
µ̂ = (3.7)
n i=1 λδt
n
P
(ri − ri−1 ) (µ − ri−1 )
1 i=1
λ= n (3.8)
δt P 2
(µ − ri−1 )
i=1
n 2
1 X [ri − (ri−1 + λ (µ − ri−1 ) δt)]
σ2 = (3.9)
n i=1 δt
we refer the reader to the Appendix (4) where the derivation and the implemented code is presented.
% Y−B( 1 ) .X−B(2)= Noise
de_trended=Y−B ( 1 ) . ∗ X−B( 2 )
figure ( 5 )
h i s t f i t ( de_trended , 1 3 )
figure ( 6 )
p r o b p l o t ( ' normal ' , de_trended )
grid on
5
Probability plot for Normal distribution
0.995
0.99
0.95
0.9
0.75
Probability
0.5
0.25
0.1
0.05
0.01
0.005
σ2
rt ∼ N r0 exp (−λt) + µ (1 − exp (−λt)) , (1 − exp (−2λt)) (4.1)
2λ
The dierence between the long term standard deviation and the deviation at t is
r r
σ2 σ2
∆σ = (1 − exp (−2λt)) − (4.2)
2λ 2λ
using Taylor expansion for exp (−2λt) ≪ 1
r
σ2
1
∆σ = 1+ exp (−2λt) − 1 (4.3)
2λ 2
so
∆σ 1
= exp (−2λt) 1 (4.4)
σ 2
the dierence between the long term mean and the mean at t is
6
we can obtain the parameters as
q̃0.95 + q̃0.05
µ= (4.10)
2
and
2
σ 2 (1.96)
λ=2 2 (4.11)
(q̃0.95 − q̃0.05 )
%% Montecarlo S i m u l a t i o n
j =1;
while j <10000
S(1)= S0 ; % S t a r t i n g p o i n t
while i <n+1
S ( i )= S ( i − 1) + lambda . ∗ ( mu−S ( i − 1)) ∗ d e l t a _ t + sigma . ∗ ( sqrt ( d e l t a _ t ) . ∗ randn ( 1 ) ) ;
i=i +1;
end
MC( j )=S (T ) ;
j=j +1;
end
figure ( 9 )
h= h i s t f i t (MC, 1 2 )
t i t l e ( ' D i s t r i b u t i o n o f t h e V a s i c e k p r o c e s s by Montecarlo S i m u l a t i o n ' ) grid on
the error associated with λ is
2 2
ln λ = ln 2 (1.96) + ln σ 2 − ln (x − y) (4.12)
using partial dierentiation we have that the maximum percentual error (for a detailed discussion on errors
analysis see [1, 2]) is given by
4λ 4σ
+ 2 (4q̃0.95 + 4q̃0.05 ) (4.13)
= 2
λ σ (q̃0.95 − q̃0.05 )
7
Distribution of the Vasicek process by Montecarlo Simulation
2500
2000
1500
1000
500
0
0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9
Appendix
Least Squares Fitting
The residuals for the model are given by
The least squares estimators for the parameters can then be found by dierentiating S with respect to these
parameters and setting these derivatives equal to zero. For b we have that
n n
∂S X X
=2 (ari + b) − 2 ri+1 (4.16)
∂b i=1 i=1
n
X n
X
ari + nb = ri+1 (4.17)
i=1 i=1
n n
!
1 X X
b= ri+1 − ari (4.18)
n i=1 i=1
isolating
n
X n
X
(ari + b) ri = (ri+1 ri ) (4.20)
i=1 i=1
then
n
X n
X Xn
ari2 + bri = (ri+1 ri ) (4.21)
i=1 i=1 i=1
8
is equal to ! !
n n n n n n
X 1 X X 1 X X X
ari2 − a ri ri + ri ri+1 = (ri+1 ri ) (4.23)
i=1
n i=1 i=1
n i=1 i=1 i=1
grouping " !# !
n n n n n n
X 1 X X X 1 X X
a ri2 − ri ri = (ri+1 ri ) − ri ri+1 (4.24)
i=1
n i=1 i=1 i=1
n i=1 i=1
nally
n
n n
1
P P P
(ri+1 ri ) − n ri ri+1
i=1 i=1 i=1
a= n
n n
(4.25)
1
ri2
P P P
− n ri ri
i=1 i=1 i=1
%% C a l i b r a t i o n u s i n g Least Squares r e g r e s s i o n
% P l o t S_i vs S_i −1
figure ( 3 )
Y= S ( 2 : end ) ; % removing f i r s t p o i n t
X=S ( 1 : end − 1);% removing t h e l a s t p o i n t
plot (Y, X, ' . ' )
l s l i n e % l e a s t squares l i n e
ylabel ( ' r_i+1 ' ) xlabel ( ' r_i ' )
t i t l e ( ' Least Squares F i t t i n g ' )
grid on
%Rewrite t h e o f f s e t term
o f f s e t=o n e s ( s i z e ( S , 2 ) − 1 , 1 ) ;
new_X=[X' , o f f s e t ] ;
B = new_X\Y' % S o l v e s in t h e Least Squares s e n s e
est_lambda=1−B ( 1 ) . / d e l t a _ t
est_mu= B( 2 ) . / ( 1 − B( 1 ) )
9
n
∂L X [ri − (ri−1 + λ (µ − ri−1 ) δt)] (µ − ri−1 ) δt
= − (4.31)
∂λ i=1 σ 2 δt
n
X [ri − (ri−1 + λ (µ − ri−1 ) δt)] (µ − ri−1 )
= − (4.32)
i=1
σ2
h i
2
Xn (ri − ri−1 ) (µ − ri−1 ) − λ (µ − ri−1 ) δt
= − =0 (4.33)
i=1
σ2
n
X Xn
2
(ri − ri−1 ) (µ − ri−1 ) = λ (µ − ri−1 ) δt (4.34)
i=1 i=1
n
P
(ri − ri−1 ) (µ − ri−1 )
1 i=1
λ= n (4.35)
δt P 2
(µ − ri−1 )
i=1
An estimator for σ
n 2
∂L n X [ri − (ri−1 + λ (µ − ri−1 ) δt)]
=− 2
(4πσδt) − −2 (4.36)
∂σ 4πσ δt i=1
2σ 3 δt
n 2
n X [ri − (ri−1 + λ (µ − ri−1 ) δt)]
=− + =0 (4.37)
σ i=1 σ 3 δt
n 2
n X [ri − (ri−1 + λ (µ − ri−1 ) δt)]
= (4.38)
σ i=1 σ 3 δt
n 2
1 X [ri − (ri−1 + λ (µ − ri−1 ) δt)]
σ2 = (4.39)
n i=1 δt
%% C a l i b r a t i o n u s i n g Maximum L i k e l i h o o d E s t i m a t o r s
n = length ( S) − 1;
Sx = sum ( S ( 1 : end − 1) ) ;
Sy = sum ( S ( 2 : end ) ) ;
Sxx = sum ( S ( 1 : end − 1).^2 ) ;
Sxy = sum ( S ( 1 : end − 1). ∗ S ( 2 : end ) ) ;
Syy = sum ( S ( 2 : end ) . ^ 2 ) ;
Acknowledgements
This work has been done under the collaboration of Aylin Chakaroglu, MSc. (Societé General RISQ/-
MAR/RIM team) who we wish to thank for the help in the revision of this report.
10
References
[1] Philip R Bevington and D Keith Robinson. Data reduction and error analysis. McGraw-Hill, 2003.
[2] William Lichten. Data and error analysis in the introductory physics laboratory. Allyn & Bacon, 1988.
[3] George E Uhlenbeck and Leonard S Ornstein. On the theory of the brownian motion. Physical review,
36(5):823, 1930.
[5] Oldrich Vasicek. An equilibrium characterization of the term structure. Journal of nancial economics,
5(2):177188, 1977.
[6] S Zeytun and A Gupta. A Comparative Study of the Vasicek and the CIR Model of the Short Rate. ITWM
Kaiserslautern, Germany, 2007.
11