在 R 编程中绘制几何分布图 – dgeom()函数
R Programming 中的dgeom()
函数用于绘制几何分布图。
Syntax: dgeom(x, prob)
Parameters:
- prob: prob of the geometric distribution
- x: x values of the plot
示例 1:
# R program to illustrat
# dgeom function to plot
# Specify x-values for dgeom function
x_dgeom <- seq(2, 10, by = 1)
# Apply dgeom function
y_dgeom <- dgeom(x_dgeom, prob = 0.5)
# Plot dgeom values
plot(y_dgeom)
输出:
示例 2:
# R program to illustrate
# dgeom() function to plot
# Specify x-values for dgeom function
x_dgeom <- seq(1, 7, by = 1)
# Apply dgeom function
y_dgeom <- dgeom(x_dgeom, prob = 0.05)
# Plot dgeom values
plot(y_dgeom)
输出: