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

Calculating density of a binomial

If you flip 10 coins each with a 30% probability of coming up heads, what is the probability exactly 2 of them are heads?

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

Foundations of Probability in R

ดูคอร์ส

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

  • Answer the above question using the dbinom() function. This function takes almost the same arguments as rbinom(). The second and third arguments are size and prob, but now the first argument is x instead of n. Use x to specify where you want to evaluate the binomial density.
  • Confirm your answer using the rbinom() function by creating a simulation of 10,000 trials. Put this all on one line by wrapping the mean() function around the rbinom() function.

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

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

# Calculate the probability that 2 are heads using dbinom


# Confirm your answer with a simulation using rbinom
แก้ไขและรันโค้ด