##### R-code for Example 8.1. It writes related data to file ##### "example81.dat" and makes "fig82.ps" #### Generate 20 batches of data with the batch size 10 from the #### t_3 distribution, and another 10 batches of data from t_3+1 set.seed(100) x1=matrix(rt(200,3),nrow=20,ncol=10) x2=matrix(rt(100,3)+1,nrow=10,ncol=10) x = rbind(x1,x2) n = length(x[,1]) # Define the charting statistic psi_i psi=rep(0,n) for(i in 1:n){ psi[i]=sum(sign(x[i,])*rank(abs(x[i,]))) } write.table(round(cbind(x,psi),digits=3), file="example81.dat",col.names=T, row.names=F) postscript("fig82.ps",width=7,height=3.5,horizontal=F) par(mfrow=c(1,2),mar=c(5,4,1,1)) xx=c(x) ii = rep(seq(1,n),10) plot(ii,xx,type="p",pch=16,xlab="i",ylab=expression(X[ij]),mgp=c(2,1,0), xlim=c(0,31), ylim=c(-11,7), cex=0.8) title(xlab="(a)",cex=0.9) i1=seq(1,n) plot(i1,psi,type="o",lty=1,pch=16,xlab="i", ylab=expression(psi[i]),mgp=c(2,1,0),xlim=c(0,31), ylim=c(-50,55),cex=0.8) lines(i1,rep(49,n),lty=2,cex=0.8) title(xlab="(b)",cex=0.9) graphics.off()