Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Compute Randomly Drawn Poisson Density in R Programming – rpois() Function

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

rpois() function in R Language is used to compute random density for poisson distribution.

Syntax: rpois(N, lambda)

Parameters:
N: Sample Size
lambda: Average number of events per interval

Example 1:




# R program to compute random
# Poisson Density
  
# Setting seed for
# random number generation
set.seed(1000)
  
# Set sample size
N <- 20
  
# Calling rpois() Function
y <- rpois(N, lambda = 5)
y

Output:

 [1] 4 6 2 6 5 2 6 5 3 3 4 6 4 7 7 2 5 6 2 5

Example 2:




# R program to compute random
# Poisson Density
  
# Setting seed for
# random number generation
set.seed(1000)
  
# Set sample size
N <- 100
  
# Calling rpois() Function
y <- rpois(N, lambda = 15)
  
# Plot a graph
plot(y)

Output:

My Personal Notes arrow_drop_up
Last Updated : 25 Jun, 2020
Like Article
Save Article
Similar Reads