Kom igångKom igång gratis

Simulating the probability of A, B, and C

Randomly simulate 100,000 flips of A (40% chance), B (20% chance), and C (70% chance). What fraction of the time do all three coins come up heads?

Den här övningen är en del av kursen

Foundations of Probability in R

Visa kurs

Övningsinstruktioner

  • You've already simulated A and B. Now simulate 100,000 flips of coin C, where each has a 70% chance of coming up heads.
  • Use A, B, and C to estimate the probability that all three coins would come up heads.

Interaktiv övning med praktiskt arbete

Testa den här övningen genom att slutföra den här exempelkoden.

# You've already simulated 100,000 flips of coins A and B
A <- rbinom(100000, 1, .4)
B <- rbinom(100000, 1, .2)

# Simulate 100,000 flips of coin C (70% chance of heads)


# Estimate the probability A, B, and C are all heads
Redigera och kör kod