在 R 编程中计算均匀分布上的分位数函数的值 – qunif()函数
在 R 编程中, qunif()
函数给出分位数函数在均匀分布上的值。
Syntax:
qunif(p, min, max, lower.tail = TRUE, log.p = FALSE)
Parameters:
p: represents probabilities vector
min, max: represents lower and upper limits of the distribution
lower.tail: represents logical value. If TRUE, probabilities are P[Xx]
log.p: represents logical value. If TRUE, probabilities are given as 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()
输出: