R语言 计算随机抽取的Wilcoxon秩和密度 – rwilcox() 函数
R语言中的 rwilcox() 函数用于计算Wilcoxon秩和统计分布在一串随机数值上的随机密度。
语法: rwilcox(N, m, n)
参数:
N: 随机矢量的大小
m: 较大的样本量
n: 较小的样本量
例1 :
# R Program to compute random
# Wilcoxonrank Sum Density
# Setting seed for
# random number generation
set.seed(1000)
# Set Vector size
N <- 20
# Calling rwilcox() Function
y <- rwilcox(N, m = 10, n = 5)
y
输出
[1] 18 21 30 32 12 32 21 24 33 24 26 35 18 27 29 21 13 15 26 31
例2 :
# R Program to compute random
# Wilcoxonrank Sum Density
# Setting seed for
# random number generation
set.seed(1000)
# Set Vector size
N <- 100
# Calling rwilcox() Function
y <- rwilcox(N, m = 40, n = 10)
# Plot a graph
plot(y)
输出: