Estimate the parameters of three spot interest rate models and draw some simulations
rf=interest(r,dt,T,model,n,r0);
The function can be used for estimating the parameters of three different models for spot interest rates, and performs some simulations of the resulting stochastic process.
The interest rate models taken into account are:
1) Merton's: the instantaneously riskless interest rate follows the stochastic differential equation
dr = mu dt + sigma dW
where dW is a Wiener process and both "mu" and "sigma" are constant;
2) Vasicek's: the instantaneously riskless interest rate follows the stochastic differential equation
dr = a (b - r) dt + sigma dW
where "a", "b", and "sigma" are all constant;
3) Cox, Ingersoll, and Ross': the instantaneously riskless interest rate follows the stochastic differential equaiton
dr = a (b - r) dt + sigma sqrt(r) dW.
First we generate 1000 uniformly distributed daily interest rate, between 4% and 6% (of course interest rates are not uniform, but this is useful just as an example).
-->r=grand(1000,1,'unf',0.04,0.06);
Then we are able to use the function. Let us see the results for all the three models. We create 10 simulations starting from the first interest rate and each simulation will be done for 1 year:
-->rf=interest(r,1/250,1,'merton',10,r(1));
!Coefficient Value !
!Drift 0.0016879 !
!Diffusion 0.1296796 !
We see that the drift "mu" is almost zero (in fact the interest rates oscillate on a sdtraight line with zero slope), while the diffusion "sigma" is quite high. The figure shows 10 possible trajectories which also have negative values with high probability. Let us see the Vasicek case:
-->rf=interest(r,1/250,1,'vasicek',10,r(1));
!Coefficient Value !
!Mean reversion 248.13562 !
!Mean 0.0498669 !
!Diffusion 0.1296796 !
The diffusion is the same as Merton's (as we expected). The mean reversion parameter "a" is very high (in fact the sample we used reverts to its mean with a remarkable strength). The mean "b" of the process is more or less 0.05 as we expected (in fact, we created interest rates uniformly distributed between 0.04 and 0.06). The figure shows ten trajectories with good oscillations. Finally, the CIR model:
--> rf=interest(r,1/250,1,'cir',10,r(1));
!Coefficient Value !
!Mean reversion 246.72311 !
!Mean 0.0498670 !
!Diffusion coeff. 0.5819574 !
Where we see values of mean reversion and mean very close to the previous one. The last term is different since the diffusion coefficient "sigma" in the CIR model must be multiplied by the square root of the interest rate. The graph should show trajectories similar to the previous ones.
"A Theory of the Term Structure of Interest Rates", Cox J.C., Ingersoll J.E. Jr., and Ross S.A., Econometrica, 53, 385-407, 1985
"On the pricing of corporate debt: The risk structure of interest rates", Merton R.C., Journal of Finance, 29, 449-470, 1971
"An Equilibrium Characterization of the Term Structure", Vasiček O., Journal of Financial Economics, 5, 177-188 (1977)
Francesco Menoncin - Brescia University - 2010