R语言: 累积概率分布曲线
2023-07-06 本文已影响0人
LET149
绘制累积概率分布曲线
plot(ecdf(aa))
1. 绘制常规概率密度曲线
aa <- rnorm(1000)
hist(aa, breaks = 20) '#绘制概率分布直方图,示例一
plot.ecdf(aa, col="red") #绘制累积概率分布,示例二
示例一
示例二
2. 绘制修饰概率密度曲线
> aa <- rnorm(20)
> hist(aa, breaks = 10) #绘制直方图,示例2.1
> bb <- ecdf(aa) #对数据进行统计
> bb #查看统计结果
Empirical CDF
Call: ecdf(aa)
x[1:20] = -1.6175, -1.5902, -1.4019, ..., 1.8859, 2.0029
> plot.ecdf(bb, do.points = T, verticals = T) #示例2.2
> plot.ecdf(bb, do.points = T, verticals = F) #示例2.3
> plot.ecdf(bb, do.points = F, verticals = T) #示例2.4
> plot.ecdf(bb, do.points = F, verticals = F) #示例2.5
2.1
2.2
2.3
2.4
2.5