📜  计算 R 编程中的泊松密度值 – dpois()函数

📅  最后修改于: 2022-05-13 01:55:16.962000             🧑  作者: Mango

计算 R 编程中的泊松密度值 – dpois()函数

R 语言中的dpois()函数用于计算一组整数值的泊松密度。它还创建了泊松分布的密度图。

示例 1:

Python3
# 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


Python3
# 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)


输出:

[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

示例 2:

Python3

# 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)

输出: