เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Probability either variable is less than or equal to 4

Suppose X is a random Binom(10, .6) variable (10 flips of a coin with 60% chance of heads) and Y is a random Binom(10, .7) variable (10 flips of a coin with a 70% chance of heads), and they are independent.

What is the probability that either of the variables is less than or equal to 4?

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Foundations of Probability in R

ดูคอร์ส

คำแนะนำการฝึกหัด

  • Simulate 100,000 draws from each of X (10 coins, 60% chance of heads) and Y (10 coins, 70% chance of heads) binomial variables, saving them as X and Y respectively.
  • Use these simulations to estimate the probability that either X or Y is less than or equal to 4.
  • Use the pbinom() function to calculate the exact probability that X is less than or equal to 4, then the probability that Y is less than or equal to 4.
  • Combine these two exact probabilities to calculate the exact probability that either variable is less than or equal to 4.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Use rbinom to simulate 100,000 draws from each of X and Y
X <- 
Y <- 

# Estimate the probability either X or Y is <= to 4


# Use pbinom to calculate the probabilities separately
prob_X_less <- 
prob_Y_less <- 

# Combine these to calculate the exact probability either <= 4
แก้ไขและรันโค้ด