Simulating Survival Functions

Overview


Simulating a survival function, is the same process as simulating any other distribution. (see Simulating a Distribution )

Given a survival function {% S %}, one can simulate the time of the modeled event by drawing a random number from the uniform distribution.
{% t = S^{-1}(random) %}

Example


This example demonstrates a simple survival function. In this case, the event occurs with equal probability between times 0 and 2, and is guaranteed to occur. Then the inverse function is
{% S^{-1}(x) = 2 \times x %}

let inv = val=>2*val;

let value = Math.random();
let time = inv(value);
					
Try it!