Вычисление случайно выбранной плотности Пуассона в программировании на R - функция rpois ()
Опубликовано: 17 Февраля, 2022
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 generationset.seed(1000) # Set sample sizeN <- 20 # Calling rpois() Functiony <- rpois(N, lambda = 5)y |
Выход:
[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 generationset.seed(1000) # Set sample sizeN <- 100 # Calling rpois() Functiony <- rpois(N, lambda = 15) # Plot a graphplot(y) |
Выход: