Vasicek Model
The Vasicek model is specified by the equation
{% dr = (b - a r) dt + \sigma dW %}
Monte Carlo Simulations
The following shows a set of simulations of the vasicek model.
copy
Code
The following code demonstrates generating a set of simulations using the ito library.
let ito = await import('/lib/statistics/simulations/v1.0.0/ito.mjs');
let a = 0.1;
let b = 0.1;
let sigma = 0.1;
let dt = function(points){
return b - a*points[points.length-1]
}
let data = [];
for(let i=0;i<5;i++){ let sims=ito.generate(300, dt, ()=>sigma, 0.5)
sims=sims.map(p =>{
return {
value:p,
sim:(i+1).toString()
}
});
data = [...data,...sims]
}
Try it!