#二項分布,ポアソン分布,正規分布の密度と分布関数のグラフ x1 <- seq(0,10,by=0.1) x2 <- seq(0,10,by=1) y1 <- dnorm(x1,mean=5,sd=sqrt(2.5)) y2 <- dbinom(x2,10,0.5) y3 <- dpois(x2,5) postscript("fig1.ps",horizontal=FALSE) par(mfrow=c(2,1)) #par(mar=c(5,6,4,3)) par(mar=c(5,6,4,6)) par(xaxs="s",yaxs="s",lab=c(6,5,4),las=1) plot(spline(x1,y1),type="l",xlab=" ",ylab=" ",xlim=c(0,10)) for(n in 1:11){ segments(x2[n],0,x2[n],y2[n],lty=2) } aa <- c(6,9.8) bb <- c(0.22,0.29) legend(aa,bb,legend=c("N(5, 2.5)","B(10,0.5)"), lty=c(1,2)) mtext("Probability Densities: Normal and Binomial", cex=1,line=1) plot(spline(x1,y1),type="l",xlab=" ",ylab=" ",xlim=c(0,10)) for(n in 1:11){ segments(x2[n],0,x2[n],y3[n],lty=2) } aa <- c(6,9.8) bb <- c(0.22,0.29) legend(aa,bb,legend=c("N(5, 2.5)","Po(5)"), lty=c(1,2)) mtext("Probability Densities: Normal and Poisson", cex=1,line=1) y1 <- pnorm(x1,mean=5,sd=sqrt(2.5)) y2 <- pbinom(x2,10,0.5) y3 <- ppois(x2,5) plot(spline(x1,y1),type="l",xlab=" ",ylab=" ",xlim=c(0,10)) for(n in 1:10){ segments(x2[n+1],y2[n],x2[n+1],y2[n+1],lty=2) segments(x2[n],y2[n],x2[n+1],y2[n],lty=1) points(x2[n],y2[n],type="p") } arrows(5.8,0.4,x1[53],y1[53],lty=1,open=T) arrows(3,0.3,3.4,y2[4],lty=1) text(6,0.35,"N(5, 2.5)") text(2.7,0.36,"B(10, 2.5)") mtext("Cumulative Distributions: Normal and Binomial", cex=1,line=1) plot(spline(x1,y1),type="l",xlab=" ",ylab=" ",xlim=c(0,10)) for(n in 1:10){ segments(x2[n+1],y3[n],x2[n+1],y3[n+1],lty=2) segments(x2[n],y3[n],x2[n+1],y3[n],lty=1) points(x2[n],y3[n],type="p") } arrows(5.8,0.4,x1[53],y1[53],lty=1,open=T) arrows(3,0.42,3.4,y3[4],lty=1) text(6,0.35,"N(5, 2.5)") text(2.7,0.48,"Po(5)") mtext("Cumulative Distributions: Normal and Poisson", cex=1,line=1)