Simulating Hazard Functions

Overview


The hazard function specifies the probability of the death event occurring at a particular point in time.
{% Prob \approx h(t) \Delta t %}

Implementation



let rand = Math.random();

let delta = 0.1;
let h = t=>0.01;

let t=1;
let death=0;
if(rand < h(t) * delta) death=1;

					
Try it!