Generates an observation using the inverse cumulative distribution method.
This method uses:
The process is the following:
1- The cumulative distribution function is used to define boundaries of observation zone. 2- An number x is drawn using a uniform distribution function 3- The zone in which the number x falls is the observation
This process can be describe using the following schema with:
0 ─ 1 ── 2 ──── 3 ─ 4 ───
Probabilities are cumulated:
0 ─ 1 ── 2 ──── 3 ─ 4 ───
Cumulated probabilities are projected on the same dimension:
├┼─┼───┼┼──┤ 0 1 2 3 4
x is drawn and the corresponding observation zone is identified using boundaries:
├┼x┼───┼┼──┤ 0 1 2 3 4
Sampling upper limit.
Observation
Generates an observation using the rejection sampling method.
This method uses a uniform random function to generate:
If the number x is lower or equal to the probability of event k, then it's an observation.
Otherwise, the process is restarted (k and x are generated).
This process can be describe using the following schema with:
p_max ────┬─┬──── │ │ ┌─┐ ┌─┤ │ │ │ ┌─┤ │ ├─┤ │ └─┴─┴─┴─┴─┘ 0 1 2 3 4
Rejection sampling method for this example do the following:
1- randomly find the potential observation k by using an uniform random function with lower limit 0 and upper limit 4. Lets say k = 0 2- draw a number x, from an uniform random function with lower limit 0 and upper limit p_max. Lets say x > p_0. In that case we restart the process from the beginning. 3- randomly find k. Lets say k = 2 4- randomly find x. Lets say x < p_2. In that case the process stop and the observation is returned.
Graphically, the following process can be represented as the following:
p_max ────┬─┬──── │o│ ┌─┐ x┌─┤ │ │ │ ┌─┤ │ ├─┤ │ └─┴─┴─┴─┴─┘ 0 1 2 3 4
Where x represents the failed attempt and o the success one.
Intuitively we "see" the returned observations will match the underlying probabilities because observations with greater probability will have a higher chance of being returned than observation with lower one.
sampling upper limit
greatest probability of the distribution
an observation
Generated using TypeDoc
This class represents a binomial distribution. It can be used to compute the probability of a given event and generate random samples from the distribution.