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

Simulating adding two binomial variables

In the last multiple choice exercise, you found the expected value of the sum of two binomials. In this problem you'll use a simulation to confirm your answer.

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

Foundations of Probability in R

ดูคอร์ส

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

  • Simulate 100,000 draws from X, a binomial with size 20 and p = .3, and Y, with size 40 and p = .1.
  • Use this simulation to estimate the expected value of X + Y.

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

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

# Simulate 100,000 draws of X (size 20, p = .3) and Y (size 40, p = .1)
X <-
Y <-

# Estimate the expected value of X + Y
แก้ไขและรันโค้ด