Inverse Bernoulli Sampling
- Choose the probability p of the desired (binary) outcome.
- Generate a random number u between 0 and 1 and compare it to p.
- If u < p, return the desired outcome; otherwise return the other outcome.
Definition
Section titled “Definition”Inverse Bernoulli sampling is a method for randomly selecting a binary outcome with a specified probability.
Explanation
Section titled “Explanation”To perform inverse Bernoulli sampling, first specify the probability p of the desired outcome. Then generate a random number u between 0 and 1. Compare u to p: a value less than p corresponds to the desired outcome, and a value greater than or equal to p corresponds to the other outcome. This procedure simulates a binary random event according to the specified probability.
In inequality form:
indicates the desired outcome, and
indicates the alternative outcome.
Examples
Section titled “Examples”Coin toss
Section titled “Coin toss”- Set the probability of heads to 0.5.
- Generate a random number between 0 and 1 using the inverse Bernoulli distribution.
- If the random number is less than 0.5, output “heads”. Otherwise, output “tails”.
Medical trial
Section titled “Medical trial”- Suppose the probability of the drug being effective is 0.75.
- Use inverse Bernoulli sampling to simulate outcomes for individual patients: a value less than 0.75 indicates the drug was effective for that patient, and a value greater than or equal to 0.75 indicates it was not.
Use cases
Section titled “Use cases”- Coin tosses
- Medical trials
- Other scenarios where a random binary event needs to be simulated
Related terms
Section titled “Related terms”- Inverse Bernoulli distribution
- Bernoulli distribution
- Binary outcome