R语言 计算随机抽样的考奇密度–rcauchy()函数
R语言中的 rcauchy() 函数用于计算一系列输入中的随机Cauchy密度。
语法: rcauchy(N, scale)
参数:
N: 样本大小
scale: 绘制图形的比例
例1 :
# R program to generate
# random cauchy density points
# Setting seed for
# random number generation
set.seed(1000)
# Set sample size
N <- 20
# Calling rcauchy() Function
y <- rcauchy(N, scale = 10)
y
输出
[1] 16.654755 -9.459054 3.740548 -14.639724 -193.891140 2.160767
[7] -10.735449 -37.226131 8.051377 10.392275 19.616577 -9.662595
[13] 15.442965 -4.484467 -9.147612 2.330620 431.105051 -22.117519
[19] 2.730892 -37.046773
例2 :
# R program to generate
# random cauchy density points
# Setting seed for
# random number generation
set.seed(1000)
# Set sample size
N <- 500
# Calling rcauchy() Function
y <- rcauchy(N, scale = 10)
# Plotting graph
plot(y)
输出: