How to implement Poisson Distribution in R?

Description

To implement the poisson distribution using R programming.

Four main functions in binomial
distribution:

dpois(x, lambda= )

  • Gives height of the probability distribution
    at each point

pnbinom(x, lambda= )

  • Gives the cumulative probability
    of an event

qnbinom(p, lambda= )

  • It takes the probability value and
    gives a number whose cumulative value
    matches the probability value.

rnbinom(x, lambda= )

  • Used to generate random numbers
    whose 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