Skip to content
Related Articles

Related Articles

Compute the Value of Poisson Density in R Programming – dpois() Function
  • Last Updated : 25 Jun, 2020

dpois() function in R Language is used to compute the Poisson Density for a set of Integer values. It also creates a desity plot of poisson distribution.

Syntax: dpois(vec, lambda)

Parameters:
vec: Sequence of integer values
lambda: Average number of events per interval

Example 1:




# R program to compute 
# Poisson Density
  
# Sequence of x-values
x <- seq(-10, 10, by = 1)
  
# Calling dpois() Function
y <- dpois(x, lambda = 5)
y

Output:



 [1] 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000 0.000000000
 [7] 0.000000000 0.000000000 0.000000000 0.000000000 0.006737947 0.033689735
[13] 0.084224337 0.140373896 0.175467370 0.175467370 0.146222808 0.104444863
[19] 0.065278039 0.036265577 0.018132789

Example 2:




# R program to compute 
# Poisson Density
  
# Sequence of x-values
x <- seq(-10, 20, by = 1)
  
# Calling dpois() Function
y <- dpois(x, lambda = 15)
  
# Plot a graph
plot(y)

Output:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :