Single Factor Heath Jarrow Morton - Monte Carlo

Single Factor Model

{% f(t,s) %} is the forward rate from s at time t.
{% d f(t,T) = \alpha(t,T)dt + \sigma_f(t,T)dW_t %}
restating this to integral form
{% f(t,T) = f(0,T) + \int_0^t \alpha(s,T)ds + \int_0^t \sigma_f(s,T) dW_s %}
It is worth noting that the short rate, {% r(t) %} is just {% f(t,t) %} or we can state:
{% r(t) = f(0,t) + \int_0^t \alpha(s,t) ds + \int_0^t \sigma_f(s,t) dW_s %}
Once we assume no arbitrage, the following relations can be derived:
{% \sigma_f(t,T) = - \frac{ \partial{} }{ \partial{T}} \sigma(t,T) %}
{% \alpha(t,T) = \sigma_f(t,T) \times \int_t^T \sigma_f(t,s) ds %}

Simulating the Brownian Motion

The single factor model listed above postulates the existence of a single Brownian motion {% dW_t %}. To simulate the HJM model in this case, we need to just simulate the single Brownian motion, and the all the other variables are computed directly from that and a set of fixed pre-specified functions.

To simulate the Brownian motion, we will use the library ito simulation library, detailed here: ito.js

For more inoformation on time series simulations:

Time Series Simulations.



The following simulation generates 5 simulations of a Brownian motion with zero drift, a volatility of 0.05, with 300 points simulated for each run.
let ito = await import('/lib/statistics/simulations/v1.0.0/ito.js'); let data = []; for(let i=0;i<5;i++){ let sims=ito.generate(300, ito.constant(0), ito.constant(0.05)) sims=sims.map(p =>{ return { value:p, sim:(i+1).toString() } }); data = [...data,...sims] } $val.set('data',data);

Choosing Forward Rate Volatility Model

Once we have the path of {% W_t %} by simulating {% dW_t %}, we want to be able to calculate the relevant forward rates. To do so, we need to be able to calculate the increments of the following equation:
{% d f(t,T) = \alpha(t,T)dt + \sigma_f(t,T)dW_t %}
To do this, we need {% \sigma_f(t,T) %} and {% \alpha(t,T) %}, however, we know from no arbitrage that
{% \alpha(t,T) = \sigma_f(t,T) \times \int_t^T \sigma_f(t,s) ds %}
This means that we just need to choose {% \sigma_f(t,T) %}. This is the forward rate volatility function.

Calculating Derived Values

Once we have a realization of the Brownian motion, we will need to calculate the paths of the variables that will be required in our simulation. For one, we will need to calculate the path of the short rate. This is because will we use the short rate to discount any cash flows. (see recovering the term structure from the short rate.)
let ito = await import('/code/ito-simulations/v1.0.0/ito-simulations.mjs'); let data = []; for(let i=0;i<5;i++){ let sims=ito.generate(300, ito.constant(0), ito.constant(0.05)) sims=sims.map(p =>{ return { value:p, sim:(i+1).toString() } }); data = [...data,...sims] } $val.set('data',data);