Get startedGet started for free

Sample from Poisson distribution

We have been provided with the average yearly number of assaults, robberies and batteries in a small city (150, 300 and 50, respectively). Given that the three types of crimes can be modeled as a multivariate Poisson distribution, you are told to create 10 different scenarios for the number of crimes in the next year.

This exercise is part of the course

Mixture Models in R

View Course

Exercise instructions

  • Using the function rpois, create 10 observations for each type of crimes using their corresponding lambda.
  • Combine the simulated number of crimes into a multivariate Poisson distribution.
  • Check the values of your simulated scenarios.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

set.seed(1541)
# Create the vector of lambdas
lambda_1 <- c(150, 300, 50)
# Create the sample of each crime
assault_1 <- ___(n = ___, lambda = ___)
robbery_1 <- ___(n = ___, lambda = ___)
battery_1 <- ___(n = ___, lambda = ___)
# Combine the results
cities_1 <- cbind(assault_1, ___, battery_1)
# Check the sample
cities_1
Edit and Run Code