R语言 计算均匀分布上的量化函数值 – qunif()函数
在R编程中, qunif() 函数给出了均匀分布的量化函数的值。
语法:
qunif(p, min, max, lower.tail = TRUE, log.p = FALSE)
参数:
p: 代表概率向量
min, max: 代表分布的下限和上限
lower.tail: 代表逻辑值。如果是TRUE,概率为P[Xx]
log.p: 代表逻辑值。如果为 “true”,概率为log(p)。
例1 :
# R program to find the value of
# Quantile Function
# Creating a vector
x <- seq(0, 1, by = 0.2)
# qunif() function
qunif(x, min = 2, max = 6)
输出
[1] 2.0 2.8 3.6 4.4 5.2 6.0
例2 :
# Create variables
x <- seq(0, 1, by = 0.02)
y <- qunif(x, min = 1, max = 5)
# Output to be present as PNG file
png(file = "qunifGFG.png")
# Plot
plot(y, type = "o")
# Saving the file
dev.off()
输出:

极客教程