Suppose X ~ Binom(n, p). Write an R function compare(n,p,k) that computes (exactly) P(X =k) P(Y= k), where Y~Pois(np).

Try your function on numbers where you expect the Poisson probability to be a good pproximation of the binomial. Also try it on numbers where you expect the approximation to be poor.

Hello Picasso,

please visit the homework policies of RStudio Community (FAQ: Homework Policy - meta / Guides & FAQs - RStudio Community) and provide a reprex (reproducible example) of your thoughts on how to solve this question.

As a hint: You might want to read about the `R`

build in function for the density of a Binomial (`dbinom()`

) and Poission (`dpois()`

) respectively.

Kind regards