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/

相关文章:

  • 2022-01-19
  • 2022-01-17
  • 2021-04-24
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2022-12-23
猜你喜欢
  • 2022-01-17
  • 2022-01-05
  • 2021-04-15
  • 2022-01-04
  • 2021-06-24
相关资源
相似解决方案