1
$\begingroup$

I've been using two approaches to simulate Vasicek short rate paths and I'm wondering if one of them is more correct than the other.

The first approach is based on the analytical formula (see code below, "OU_processes"), whereby every next simulated rate along a path is calculated from the previously simulated rate one timestep ago as follows:

enter image description here

def OU_processes(years, timestep, num_sims, startRate, kappa, theta, sigma):
    """
    timestep has to be defined in years or a fraction of years
    e.g. 0.1 => 1/10th of a year; 2 => 2 years
    """
    times = np.arange(0,years+timestep,timestep)
    epsilon = np.random.normal(0, 1, (num_sims, len(times)-1))
    elt = 0.5 / kappa * (1.0 - np.exp (-2.0 * kappa * timestep))
    V = elt * sigma ** 2 
    sqrt_V = np.sqrt(V) 
    ou = np.zeros((num_sims, len(times)))
    ou[:,0] = startRate
    ou[:, 1:] = np.kron(sqrt_V, np.ones((num_sims, 1))) * epsilon
    for i in range(1, ou.shape[1]):
        ou[:, i] += theta * (1 - np.exp(-kappa * timestep))
        ou[:, i] += np.exp (-kappa * timestep) * ou[:, i-1]
    ou = pd.DataFrame(np.transpose(ou))
    ou.index = times
    return ou

The second approach uses Euler discretization (see code below, "discretized_OU"):

enter image description here

def discretized_OU(years, timestep, num_sims, startRate, kappa, theta, sigma):
    times = np.arange(0,years+timestep,timestep)
    epsilon = np.random.normal(0, 1, (num_sims, len(times)-1))
    ou=np.zeros((num_sims,len(times)))
    ou[:,0] = startRate
    for step in np.arange(1,int(years/timestep)+1,1):
        ou[:,step]=ou[:,step-1]+kappa*(theta-ou[:,step-1])*timestep+sigma*np.sqrt(timestep)*epsilon[:,step-1]
    ou = pd.DataFrame(np.transpose(ou))
    ou.index = times
    return ou

Could anyone tell me what the difference is between both methods? The paths simulated using the analytical method lead to a ZCB price that is very close to the price found using the analytical Vasicek ZCB formula, while the paths simulated using the discretized approach lead to a price that is somewhat further from the analytical price (although still very close to it) and with a seemingly larger standard deviation:

enter image description here

Moreover, is it correct that only the second approach is available for simulating CIR paths?

Many thanks in advance.

$\endgroup$
3
  • $\begingroup$ Look up the variance bias trade off. For the CIR there is an exact formula for the distribution (as there is for the Vasicek model) which uses the non central chi-squared distribution. $\endgroup$ – oliversm Oct 14 '20 at 8:45
  • $\begingroup$ Hi @oliversm, Thanks for your reply. Could you maybe provide a reference that discusses this variance-bias trade off in this exact context? For the Vasicek model, I mainly seem to read that the solution would be to increase the number of time steps. Would that lead to convergence between the discretized price and the analytical price? Thanks again for your comment. $\endgroup$ – Bart S Oct 14 '20 at 13:45
  • $\begingroup$ The variance bias trade off (with a good Monte Carlo interpretation) is readily googled, but for a concrete reference you can't beat Glasserman. Increasing the number of time steps will reduce the bias aka the weak error, which if you want another good reference, see Kleoden and Platen. Both references discuss the Euler-Maruyama scheme. Increasing the number of steps should ensure you converge to the same number, then it is just a matter of having lots of paths to reduce the variance. Don't be surprised though if it requires very fine discretisations (e.g. thousands of steps). $\endgroup$ – oliversm Oct 14 '20 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.