用来计算一组数的概率密度
aa <- rnorm(1e5)
bb <- density(aa) '# 统计概率分布
> bb
Call:
density.default(x = aa)
Data: aa (100000 obs.); Bandwidth 'bw' = 0.09045
x y
Min. :-5.1057 Min. :0.0000000
1st Qu.:-2.6619 1st Qu.:0.0006932
Median :-0.2181 Median :0.0213516
Mean :-0.2181 Mean :0.1022017
3rd Qu.: 2.2256 3rd Qu.:0.1892256
Max. : 4.6694 Max. :0.3988726
plot(density(aa)) #对概率分布进行可视化
plot(bb)
图片.png
网友评论