在 R 编程中计算负二项式分位数函数的值 – qnbinom()函数
R语言中的qnbinom()
函数用于计算负二项式分位数函数的值。它还创建了负二项式分位数函数的密度图。
Syntax: qnbinom(vec, size, prob)
Parameters:
vec: x-values for binomial density
size: Number of trials
prob: Probability
示例 1:
# R program to compute value of
# Negative Binomial Quantile Function
# Vector of x-values
x <- seq(0, 1, by = 0.1)
# Calling qnbinom() Function
y <- qnbinom(x, size = 100, prob = 0.5)
y
输出:
[1] 0 82 88 92 96 99 103 107 112 118 Inf
示例 2:
# R program to compute value of
# Negative Binomial Quantile Function
# Vector of x-values
x <- seq(0, 1, by = 0.01)
# Calling qnbinom() Function
y <- qnbinom(x, size = 100, prob = 0.8)
# Plot a graph
plot(y)
输出: