# # Written by: # -- # John L. Weatherwax 2009-04-21 # # email: wax@alum.mit.edu # # Please send comments and especially bug reports to the # above email address. # #----- stem <- function(x,y,pch=16,linecol=1,clinecol=1,...){ if (missing(y)){ y = x x = 1:length(x) } plot(x,y,pch=pch,...) for (i in 1:length(x)){ lines(c(x[i],x[i]), c(0,y[i]),col=linecol) } lines(c(x[1]-2,x[length(x)]+2), c(0,0),col=clinecol) } N=41 z_r_k = c( 0.88, 0.83, 0.72, 0.67, 0.56, 0.53, 0.43, 0.41, 0.32, 0.29, 0.21, 0.18 ) zd_r_k = c( -0.83, 0.68, -0.70, -0.65, 0.62, -0.70, 0.69, -0.60, 0.55, -0.60, 0.62 ) z4d_r_k = c( 0.21, 0.06, 0.15, -0.34, -0.10, 0.03, -0.18, -0.13, 0.02, -0.04, 0.10, 0.22 ) zd4d_r_k = c( -0.33, 0.06, 0.36, -0.45, 0.08, 0.22, -0.10, -0.05, 0.14, -0.12, -0.05, 0.28 ) #postscript("../../WriteUp/Graphics/Chapter9/prob_6_zrk_plot.eps", onefile=FALSE, horizontal=FALSE) stem( z_r_k, pch=18 ) abline(h=+2/sqrt(N),col="red") abline(h=-2/sqrt(N),col="red") #dev.off() #postscript("../../WriteUp/Graphics/Chapter9/prob_6_zdrk_plot.eps", onefile=FALSE, horizontal=FALSE) stem( zd_r_k, pch=18 ) abline(h=+2/sqrt(N-1),col="red") abline(h=-2/sqrt(N-1),col="red") #dev.off() #postscript("../../WriteUp/Graphics/Chapter9/prob_6_z4drk_plot.eps", onefile=FALSE, horizontal=FALSE) stem( z4d_r_k, pch=18 ) abline(h=+2/sqrt(N-4),col="red") abline(h=-2/sqrt(N-4),col="red") #dev.off() #postscript("../../WriteUp/Graphics/Chapter9/prob_6_zd4drk_plot.eps", onefile=FALSE, horizontal=FALSE) stem( zd4d_r_k, pch=18 ) abline(h=+2/sqrt(N-5),col="red") abline(h=-2/sqrt(N-5),col="red") #dev.off()