Welcome to THETAWIKI. If you like to create or edit a page please make sure to login or register an account. All registered users please make sure to provide a valid email address.

# Vasicek model

## Overview

The Vasicek(1977) model is a simple short rate model. It is originally a one factor model and assumes that short rates are driven by one source of risk. We describe the Vasicek model below and use it to obtain analytical bond prices.

## The Vasicek Model

The instantaneous short rate has the following stochastic process under the risk-neutral measure $Q$:

$dr(t) = a\,(b - r(t))dt\,+\,\sigma d W(t), \qquad (Vas.1)$

where $W(t)$ is a standard Wiener process under $Q$. The terms $a$ and $b$ are, respectively, mean reversion speed and mean reversion level of the short rate.

Simple integration of equation (Vas.1) from time $s$ to $t$ ($0 \leqslant s \leqslant t$) yields

$r(t) = r(s)e^{-a(t-s)}+ a\,b \int_s^t e^{-a(t-u)}du +\sigma \int_s^t e^{-a(t-u)} dW(u)$
$= r(s)e^{-a(t-s)}+ b (1- e^{-a(t-s)}) +\sigma \int_s^t e^{-a(t-u)} dW(u), \qquad (Vas.2)$

From Equation (Vas.2), we can obtain the first two conditional moments of the short rate $r(t)$ for the Vasicek(1977) model:

$\mathbb{E} \left [ r(t)\mid r(s) \right ]= r(s)e^{-a(t-s)}+ b (1- e^{-a(t-s)}), \qquad (Vas.3)$
$Var \left [ r(t)\mid r(s) \right ]= \frac {\sigma^2}{2a} (1-e^{-2a(t-s)}). \qquad (Vas.4)$

The price of a zero-coupon bond at time $t$ with maturity time $T$ is

$P(t,T)= \mathbb{E}^Q \left [e^{-\int_t^T r(u)du} \mid \mathcal{F}_t \right ], \qquad (Vas.5)$

where $\mathbb{E}^Q \left [ \, \right ]$ is taken with respect to the risk-neutral measure $Q$.

Because the noise part is additive in equation (Vas.1), the distributional properties of $\int_t^T r(u) dt$ are known. From the fundamenatal pricing relation in equation (Vas.5), zero-coupon bond price as the risk-neutral expectation of a functional of the short rate can be calculated analytically, this is what we turn to next.

To obtain an analytic solution of the zero-coupon bond price, we first evaluate the following Ito integral

$\int_t^T r(u)du$
$= \int_t^T r(t) e^{-a(u-t)}\,du\,+\,b\, \int_t^T (1-e^{-a(u-t)})\,du \,+\,\sigma \int_t^T \int_t^u e^{-a(u-s)}\,d W(s)\,du$
$= r(t) \frac { 1-e^{-a(T-t)} } {a}\,+\,b\, [T\, -\, t \,-\, \frac {1-e^{-a(T-t)}}{a}]\,+\,\sigma \int_t^T \int_t^u e^{-a(u-s)}\,d W(s)\,du. \qquad (Vas.6)$

The conditional expectation of the Ito integral $\int_t^T r(u)du$ is:

$\mathrm{E} \left [ \int_t^T r(u)du \mid \mathcal{F}_t \right ] =r(t) \frac { 1-e^{-a(T-t)} } {a}\,+\,b\, [T\, -\, t \,-\, \frac {1-e^{-a(T-t)}}{a}]. \qquad (Vas.7)$

The conditional variance of $\int_t^T r(u)du$ is calculated as follows:

$Var \left [ \int_t^T r(u)du \mid \mathcal{F}_t \right ]$
$= Var \left [ \sigma \int_t^T \int_t^u e^{-a(u-s)} d W(s)\,du \mid \mathcal{F}_t \right ]$
$= \mathrm{E} \left [ \left ( \sigma \int_t^T \int_s^T e^{-a(u-s)} du\,dW(s) \mid \mathcal{F}_t \right )^2 \right ]$
$= \sigma^2 \int_t^T \left [ \int_s^T e^{-a(u-s)} du \right ]^2 \,ds$
$= \sigma^2 \int_t^T \left [ \frac {1-e^{-a(T-s)}}{a} \right ]^2 \,ds$
$= \frac {\sigma^2}{a^2} \int_t^T \left [ 1 \,+\,e^{-2a(T-s)}\,-\,2 e^{-a(T-s)} \right ] \,ds$
$= \frac {\sigma^2}{a^2} \left [T\,-\,t\,+\, \frac {1-e^{-2a(T-t)}}{2a} \,-\,2 \frac {1-e^{-a(T-t)}}{a} \right ], \qquad (Vas.8)$

where in the second equality we have used Fubini's theorem for change of integrals, and the third equality follows from Ito isometry.

Using the pricing relation in equation (Vas.5) and the properties of lognormal random variables, we have

$P(t,T)= \mathbb{E}^Q \left [ e^{- \int_t^T r(u)du} \mid \mathcal{F}_t \right ]$
$= e^{ \mathrm{E} \left [ - \int_t^T r(u)du \right ] \,+\, \frac {1}{2} Var \left [ -\int_t^T r(u)du \right ] }, \qquad (Vas.9)$

plugging in equations (Vas.7) and (Vas.8) into equation (Vas.9), and simplifying, we have the following solution for equation (Vas.5)

$P(t,T)=A(t,T)e^{-B(t,T)r(t)}, \qquad (Vas.10)$

where

$B(t,T)=\frac{1-e^{-a(T-t)}}{a},\!$

and

$A(t,T)=\exp{ \left( \frac{ (B(t,T)-T+t)(a^2b-\sigma^2/2)}{a^2} - \frac{\sigma^2B(t,T)^2}{4a} \right) }.$

## The Vasicek model implemented in ThetaML

The Vasicek model implemented in ThetaML is given below:

model vasicek
%This model simulates short rates with Vasicek dynamics
%Example input parameters:
%a = 1.5, b = 0.1, sigma = 0.2, r0 = 0.03, t = 1, ht = 1/12
import a      "Mean reversion speed"
import b      "Mean reversion level"
import sigma  "Short rate volatility"
import r0     "Initial short rate"
import t      "Simulation time horizon"
import ht     "Discretization time step"
export r      "Simulated future short rates"

r = r0        %initialize the short rate at time 0
%a fixed loop that loops t/ht times
loop t/ht
%the ThetaML command 'theta' advances time by ht step
theta ht
%sample a Gaussian random variable
dz = sqrt(ht)*randn()
%update the increments of short rate
dr = a*(b - r)*ht + sigma*dz
%short rate at this model time
r = r + dr
end
end