### Stats, ML, Data - Python/R Programs and code related to Poisson Distribution

 Question 1The number of typos on the page of a book has a Poisson distribution with mean 1.2. Find the probability that the number of typos -on page 10 is 2;on page 1 is less than 3;on first ten pages totals 5;on all forty pages adds up to at least 3.R program - using functions for Poisson Distributions, like dpois and ppois``````lambda <- 1.2 cat(format(dpois(2, lambda), digits = 3), format(ppois(2, lambda), digits = 3), format(dpois(5, 10 * lambda), digits = 3), format(ppois(2, 40 * lambda, lower = FALSE), digits = 3, nsmall = 3), sep = "\n");``````Python program`import math``mu = 1.2``print "{:0.3f}".format(math.exp(-mu)*(mu**2)/2)``print "{:0.3f}".format(math.exp(-mu)*(mu**2)/2+math.exp(-mu)*mu+math.exp(-mu))``print "{:0.3f}".format(math.exp(-mu*10)*((mu*10)**5)/120)``print "{:0.3f}".format(1 - (math.exp(-40*mu)*((40*mu)**2)/2+math.exp(-40*mu)*40*mu+math.exp(-40*mu)))`Question 2A random variable X follows the Poisson distribution with mean 5, find the probability with which the random variable X is equal to 10; i.e. P(X = 10).R code``write(round(((2.71^(-5)*5^5) / factorial(10)),3), stdout())``Python code`# Enter your code here. Read input from STDIN. Print output to STDOUT``import math``mean = 2.5``k = 5``num = float (math.pow(mean, k) * math.exp(-1*mean))``deno = float(math.factorial(k))``print num/deno`Question 3The number of calls per minute into a ticketing center for travel reservations is Poisson random variable with mean 3.(a) Find the probability that no calls come in a given 1 minute period.(b) Assume that the number of calls arriving in two different minutes are independent. Find the probability that atleast two calls will arrive in a given two minute period.Python program`from math import factorial, exp``def poisson(mean,k):``    return mean**k * exp(-mean) / factorial(k)``mean = 3``print "%.3f" % poisson(mean,0)``print "%.3f" %  (1 - poisson(mean,0)*poisson(mean,0) - poisson(mean,0)*poisson(mean,1) - poisson(mean,1)*poisson(mean,0))`R program - using functions for Poisson Distributions, like dpois ``````cat(sprintf("%.3f\n", dpois(0, 3))) cat(sprintf("%.3f\n", 1 - 2 * dpois(0, 3) * dpois(1, 3) - dpois(0, 3) * dpois(0, 3) ))``````