rm(list=ls(all=TRUE))
options(digits=7)
setwd("C:/Rtemp")
cat("\014")
options(digits=10)
options(scipen=10)

dpois(0,5)
dpois(1,5)

x=seq(0,20,by=1)
Prob.x=dpois(x,5)
table=data.frame(x,Prob.x)
table

x=seq(0,15,by=1)
plot(x,dpois(x,5),type="h")
lines(x,dpois(x,5),type="p")


ppois(0,5)
ppois(1,5)
ppois(2,5)

x=seq(0,30,by=1)
Cum_Prob.x=ppois(x,5)
table=data.frame(x,Cum_Prob.x)
table


Prob=function(a,b,mu) ppois(b,mu)-ppois(a-1,mu)
Prob(1,2,5)
Prob(1,4,5)
Prob(2,7,5)
Prob(6,100,5)
1-Prob(0,5,5)



Prob_hyper=function(x,N,n,k) dhyper(x,k,N-k,n)
Prob_hyper(0,18,6,10)
Prob_hyper(1,18,6,10)
Prob_hyper(2,18,6,10)
Prob_hyper(3,18,6,10)