Skip to content

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.

Inverse Bernoulli sampling is a method for randomly selecting a binary outcome with a specified probability.

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:

u<pu < p

indicates the desired outcome, and

upu \ge p

indicates the alternative outcome.

  • 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”.
  • 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.
  • Coin tosses
  • Medical trials
  • Other scenarios where a random binary event needs to be simulated
  • Inverse Bernoulli distribution
  • Bernoulli distribution
  • Binary outcome