function(PDF=F){ if(PDF==T) pdf(file="stochorder.pdf",width=11) par(mfrow=c(2,1),mar=c(5,4,0.2,1)+.1) x=seq(-3,3,.01) y1=pnorm(x) y2=punif(x,min=0,max=2) plot(x,y1,xlab="x",ylab="CDF",type="l",axes=F) axis(1) axis(2) abline(h=c(0,1),col="grey") lines(x,y2,lty=2) legend(-3,.9,expression(F(x)==Phi(x)~"standard normal", list(G(x)==x/2, x %in%~"(0,2)")~" Uniform(0,2)"),lty=c(1,2),bty="n",y.intersp=1.2) text(1,.1,"not stochastically ordered",adj=0) x=seq(0,4,.01) y1=punif(x,0,4) y2=y1^1.2 plot(x,y1,xlab="x",ylab="CDF",type="l",axes=F) legend(0,.9,expression(list(F(x)==x/4, x %in%~"(0,4)")~" Uniform(0,4)", G(x)==F(x)^"1.2"),bty="n",lty=c(1,2),y.intersp=1.2) axis(1) axis(2) abline(h=c(0,1),col="grey") lines(x,y2,lty=2) text(2.5,.1,"stochastically ordered",adj=0) par(mfrow=c(1,1)) if(PDF==T) dev.off() }