在 R 编程中计算随机绘制的对数法向密度 – rlnorm()函数
R 语言中的rlnorm()
函数用于计算一系列输入之间的随机对数正态密度。
Syntax: rlnorm(N)
Parameters:
N: Sample Size
示例 1:
# R program to generate
# random log normal density points
# Setting seed for
# random number generation
set.seed(1000)
# Set sample size
N <- 20
# Calling rlnorm() Function
y <- rlnorm(N)
y
输出:
[1] 0.6403257 0.2994354 1.0419837 1.8953214 0.4554113 0.6801178 0.6213456
[8] 2.0539211 0.9816646 0.2533159 0.3744010 0.5743659 1.1290552 0.8861471
[15] 0.2628844 1.1853730 1.1677499 1.0252453 0.1291752 1.2375754
示例 2:
# R program to generate
# random log normal density points
# Setting seed for
# random number generation
set.seed(1000)
# Set sample size
N <- 500
# Calling rlnorm() Function
y <- rlnorm(N)
# Plot a graph
plot(y)
输出: