Splus プログラムの実行 srv に telnet や X-Vision で接続した後, srv% のプロンプトの後に Splus < progname.prog > progname.out と入力してください.progname.prog は Splus のプログラムが入っている ファイル,progname.out は実行結果を保存するファイルです.progname は 任意の名前です.実行結果を見るには srv% の後に mule progname.out と入力してください.実行結果に誤りがあるときは,progname.out を rm progname.out で消去してから, mule progname.prog にアクセスして,必要な修正をしてください.そのあとで,再度 Splus < progname.prog > progname.out としてください. ----------------------------------------------------------------- プログラム例(グラフィックは ps ファイルに出力される) 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) } #axis(1,at=xjiku,labels=xjiku) #axis(2,at=yjiku,labels=yjiku) #lines(yy[,1],yy[,2],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) #axis(1,at=xjiku,labels=xjiku) #axis(2,at=yjiku,labels=yjiku) #lines(yy[,1],yy[,2],lty=2) 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)