How to implement Poisson Distribution in R?

Description

To implement the poisson distribution using R programming.

Four main functions in binomialdistribution:

  dpois(x, lambda= )

  Gives height of the probability distributionat each pointpnbinom(x, lambda= )

   Gives the cumulative probabilityof an eventqnbinom(p, lambda= )

   It takes the probability value andgives a number whose cumulative valuematches the probability value.

  rnbinom(x, lambda= )Used to generate random numberswhose distribution is binomial.

x -- vector

Lambda -- vector of (non-negative)means.

#Poisson Distribution
#dpois
x<-seq(0,100,by=1)
y<-dpois(x,lambda = 10)
plot(x,y,col=”blue”)

#ppois
y<-ppois(x,lambda = 50)
plot(x,y,col=”red”)

#qpois
y<-qpois(p=0.6,lambda = 20)
print(y)

#rpois
x<-rpois(200,lambda = 30)
hist(x,col=285)

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit