ComeçarComece de graça

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.

Este exercício faz parte do curso

Mixture Models in R

Ver curso

Instruções do exercício

  • 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.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

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
Editar e executar o código