Sum of two Poisson variables
One of the useful properties of the Poisson distribution is that when you add multiple Poisson distributions together, the result is also a Poisson distribution.
Here you'll generate two random Poisson variables to test this.
This exercise is part of the course
Foundations of Probability in R
Exercise instructions
- Simulate 100,000 draws from the Poisson(1) distribution, saving them as
X
. - Simulate 100,000 draws separately from the Poisson(2) distribution, and save them as
Y
. - Add
X
andY
together to create a variableZ
. - We expect
Z
to follow a Poisson(3) distribution. Use thecompare_histograms
function to compareZ
to 100,000 draws from a Poisson(3) distribution.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Simulate 100,000 draws from Poisson(1)
# Simulate 100,000 draws from Poisson(2)
# Add X and Y together to create Z
# Use compare_histograms to compare Z to the Poisson(3)