# Complete Algorithm of Calibration with Vasicek Model using Term-Structure Dynamics over Time

As there are so many different sccenarios about Vaicek Calibration but there has not been a clear example with data shown, I am totally Confused about how should I do it. so I am bringing the question here and I hope someone can help me.

So assume we have a table of historical data like this:

|Date/Maturity| 3 Month | 1 year | 3 year | 5 year | 10 year|
|:----------- |--------:|:------:|:------:|:------:|:------:|
| jan 15      | 0.0012  | 0.0129 |   .    |  .     |    .   |
| feb 15      | 0.0013  | 0.0122 |   .    |  .     |    .   |
| mar 15      | 0.0015  | 0.0123 |   .    |  .     |    .   |
| apr 15      | 0.0012  | 0.0119 |   .    |  .     |    .   |
| may 15      | 0.0011  | 0.0122 |   .    |  .     |    .   |
| jun 15      | 0.0017  | 0.0121 |   .    |  .     |    .   |


( I didn't complete the final lines because of frustration of writing table here, but they are all numbers. )

I want to calibrate the vasicek model for this data. which means finding parameters a,b,sigma in a way that the vasicek formula matches the best.

I know the first steps which are as follows:

• assume initial values for $r_0$. e.g $r_0 = 0.0010$ and also for a,b and $\sigma$.
• calculate the euler discritization and get instantaneous interest rate with different scenarios. for example here we make 6 scenarios because we have 6 months. the formula is as follows: $$r_{i+1} = a(b-r_i)\Delta t + \sigma \sqrt{\Delta t} z_i$$ where $z_i$ is a standard normal distribution
• Here I put the plot for 6 scenarios made by Matlab: • the Next Step would be to take the next r in each sample. i.e. $r_1$ and use it as instantaneous rate for yield curves. this means we get 6 yield curves from the following formula: $$R(\tau) = -\frac{1}{\tau} ln(P(\tau))$$ $$P(\tau) = A(\tau) . exp(-B(\tau)r(t))$$ with known A and B taken from Vasicek Model.
• Now we get the mean of this 6 scenarios for each time to maturity and e.g get an array of 5 numbers which are maturities for 3 month, 1 year, 3 year, 5 year and 10 year.

• And then I don't know what happens next? Should i use Least squares? Where are we going use the real data values? Am I missing something in the first steps?

I Appreciate any help.