Poisson Distributions
The probability mass function of Poisson distribution at x with parameter lambda is given bypmf = dpois(x,lambda)Similarly the cumulative distribution function is obtained by ppois(x,lambda).
lambda = 0.5 n = 15 x = 0:n prob = dpois(x,lambda) par(mfrow=c(2,1)) plot(c(-0.5,n+0.5),c(0,max(prob)+0.1),type='n',main='p.m.f',xlab='x',ylab='pmf') prob.mass(x,prob,col='green') x = c(-0.5,x,n+0.5) cdf = ppois(x,lambda) plot(x,cdf,type='s',col='red',main='c.d.f') lines(c(-0.5,n+0.5),c(1,1),lty=2,col='red') cdf
Programming Note. The function par(mfrow=c(2,1)) set the parameter mfrow=c(2,1) which splits the multiple graphics to assign 2 figures horizontally and one vertically.
Sample R code. You can download poisdemo.R, and run it.
Poisson approximation to binomial distribution.
When n is large and p is small
enough for np to become a moderate number,
the binomial frequency function with parameter (n,p)
can be approximated by
that of the Poisson distribution with parameter
.
n = 30 p = 0.1 x = 0:n bpmf = dbinom(x,n,p) par(mfrow=c(1,1)) plot(c(-0.5,max(x)+0.5),c(0,max(bpmf)*1.1),type='n', main='Binomial distribution', xlab='x',ylab='pmf') prob.mass(x,bpmf,col='green')
Here we can use a Poisson distribution as an approximation for a binomial distribution.
lambda = n*p ppmf = dpois(x,lambda) prob.mass(x,ppmf,col='red',density=10) legend(x=0.7*n, y=max(bpmf)*1.1, legend=c('Binomial','Poisson'), col=c('green','red'),pch=c(15,22))
Sample R code. You can download poisapp.R, and run it.
© TTU Mathematics