beta函数分布图

set.seed(1)
x<-seq(-5,5,length.out=10000)


a = c(.5,0.6, 0.7, 0.8, 0.9)
b = c(.5,  1,   1,   2,  5)
color = c("red", "green", "blue", "orange", "black")

y<-dbeta(x,a[1],b[1])
  
plot(x,y,col=color[1],xlim=c(0,1),ylim=c(0,6),type='l',
     xaxs="i", yaxs="i",ylab='density',xlab='',
     main="The Beta Density Distribution")

for(i in 2:length(b)){
    y<-dbeta(x,a[i],b[i])
    lines(x,y,col=color[i])
}

legend("top",legend=paste("a=",a," b=", b), lwd=1, col=color)

参考 http://blog.fens.me/r-density/


--- 她说, 她是仙,她不是神
原文地址:https://www.cnblogs.com/bregman/p/4430711.html