#rpoi(n,lamda)generates n random values from the Poisson distribution.
rpois(10,6)


#dpois(x,lamda)returns the probability of exactly x occurrences in a single interval. As usual in R, x can be a vector.
dpois(0:3,6)


#ppois(x,lamda)returns the probability of at most x occurrences in a single interval. In other words, it's the CDF.
ppois(0:3,6)

#qpois(p,lamda)returns the smallest integer x such that ppois(x,lamda)>=p.That is, it computes quantiles in the specified Poisson distribution
qpois(.7,6)
ppois(6:7,6)


#Example. Calls to a customer service line come at an average rate of 6 every 5 mins.
#1.Whay is the probability that there are exactly 4 calls in a 5-mins period?That there are at least 4?
dpois(4,6)
1-ppois(3,6)# the complement of the event where we have at most 3.
#Construct a probability histogram for the number of calls to the line in a given 5-mins period.
x<-0:15
probability<-dpois(x,6)
probability
library(tidyverse)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: