##### R-code for Example 3.5 and Fig 3.6. It writes related data to file ##### "example35.dat" #### Generate 20 batches of data with the batch size 10 from the #### t_4 distribution, and another 10 batches of data from t_4+1.5 set.seed(10) x1=matrix(rt(200,4),nrow=20,ncol=10) x2=matrix(rt(100,4)+1.5,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="example35.dat",col.names=T, row.names=F) pdf("fig36.pdf",width=7,height=3.5) 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="n",ylab=expression(X[nj]),mgp=c(2,1,0), xlim=c(0,31), ylim=c(-7,7), cex=0.8) title(xlab="(a)",cex=0.9) i1=seq(1,n) plot(i1,psi,type="o",lty=1,pch=16,xlab="n", ylab=expression(psi[n]),mgp=c(2,1,0),xlim=c(0,31), ylim=c(-40,55),cex=0.8) lines(i1,rep(49,n),lty=2,cex=0.8) title(xlab="(b)",cex=0.9) graphics.off()