常用连续型概率分布
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
常用连续型概率分布
概率密度函数图及R语言实现
作者:张丹(@Conan_Z)
Email: bsspirit@
Website: http://www.fens.me
日期:2012-11-26
正态分布
n=100
x <- seq(-5,5,length.out=n)
plot(x,dnorm(x,0,1),col="red",xlim=c(-5,5),ylim=c(0,1),type='l',
xaxs="i", yaxs="i",ylab='density',xlab='',
main="The Normal Density Distribution")
lines(x,dnorm(x,0,0.5),col="green")
lines(x,dnorm(x,0,2),col="blue")
lines(x,dnorm(x,-2,1),col="orange")
legend("topright",legend=paste("m=",c(0,0,0,-2)," sd=", c(1,0.5,2,1)), lwd=1, col=c("red", "green","blue","orange"))
指数分步
n=100
x<-seq(-1,2,length.out=n)
plot(x,dexp(x,0.5),col="red",xlim=c(0,2),ylim=c(0,5),type='l', xaxs="i", yaxs="i",ylab='density',xlab='',
main="The Exponential Density Distribution")
lines(x,dexp(x,1),col="green")
lines(x,dexp(x,2),col="blue")
lines(x,dexp(x,5),col="orange")
legend("topright",legend=paste("rate=",c(.5, 1, 2,5)), lwd=1, col=c("red", "green","blue","orange"))
γ(伽玛)分布
n=100
x<-seq(0,10,length.out=n)
plot(x,dgamma(x,1,2),col="red",xlim=c(0,10),ylim=c(0,2),type='l',
xaxs="i", yaxs="i",ylab='density',xlab='',
main="The Gamma Density Distribution")
lines(x,dgamma(x,2,2),col="green")
lines(x,dgamma(x,3,2),col="blue")
lines(x,dgamma(x,5,1),col="orange")
lines(x,dgamma(x,9,1),col="black")
legend("topright",legend=paste("shape=",c(1,2,3,5,9)," rate=", c(2,2,2,1,1)), lwd=1, col=c("red", "green","blue","orange","black"))
weibull分布
x <- seq(0, 2.5, length.out=1000)
plot(x, dweibull(x, .5), type="l", col="blue",xlim=c(0, 2.5),ylim=c(0, 2.5), xaxs="i", yaxs="i",ylab='density',xlab='',
main="The Weibull Density Distribution")
lines(x, dweibull(x, 1), type="l", col="red")
lines(x, dweibull(x, 1.5), type="l", col="magenta")
lines(x, dweibull(x, 5), type="l", col="green")
legend("topright", legend=paste("shape =", c(.5, 1, 1.5, 5)), lwd=1, col=c("blue", "red", "magenta", "green"))
n=100
x <- seq(-5,5,length.out=n)
plot(x,df(x,1,1,0),col="red",xlim=c(-2,2),ylim=c(-10,2),type='l',
xaxs="i", yaxs="i",ylab='density',xlab='',
main="The F Density Distribution")
lines(x,df(x,1,1,2),col="green")
lines(x,dt(x,2,2,2),col="blue")
lines(x,dt(x,2,4,2),col="orange")
legend("bottomright",legend=paste("df1=",c(1,1,2,2),"df2=",c(1,1,2,4)," ncp=", c(0,2,2,2)), lwd=1, col=c("red", "green","blue","orange"))
n=100
x <- seq(-5,5,length.out=n)
plot(x,dt(x,1,0),col="red",xlim=c(-5,5),ylim=c(0,0.5),type='l',
xaxs="i", yaxs="i",ylab='density',xlab='',
main="The T Density Distribution")
lines(x,dt(x,5,0),col="green")
lines(x,dt(x,5,2),col="blue")
lines(x,dt(x,50,2),col="orange")
legend("topleft",legend=paste("df=",c(1,5,5,50)," ncp=", c(0,0,2,2)), lwd=1, col=c("red", "green","blue","orange"))