R语言 计算随机抽取的对数正态密度 – rlnorm()函数
R语言中的 rlnorm() 函数用于计算一系列输入中的随机对数正态密度。
语法: rlnorm(N)
参数:
N: 样本大小
例子 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)
输出: