在 R 编程中计算随机绘制的 Weibull 密度 – rweibull()函数
R 语言中的rweibull()
函数用于计算 Weibull 分布的随机密度。
Syntax: rweibull(N, shape)
Parameters:
N: Sample Size
shape: Shape Parameter
示例 1:
# R program to compute random
# Weibull Density
# Setting seed for
# random number generation
set.seed(1000)
# Set sample size
N <- 20
# Calling rweibull() Function
y <- rweibull(N, shape = 0.5)
y
输出:
[1] 1.24347372 0.07615159 4.71808321 0.13687770 0.43674779 7.24744843
[7] 0.09171405 0.29014465 2.35173196 1.85531597 1.10250171 0.07863894
[13] 1.31925387 0.02076093 0.07234868 6.85850214 0.50129483 0.20600265
[19] 6.08499134 0.28943273
示例 2:
# R program to compute random
# Weibull Density
# Setting seed for
# random number generation
set.seed(1000)
# Set sample size
N <- 100
# Calling rweibull() Function
y <- rweibull(N, shape = 0.5)
# Plot a graph
plot(y)
输出: