# # 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. # #----- save_plots = F # Ex 4.88 (EPage 178): # y = c( 152.7, 172.0, 172.5, 173.3, 193.0, 204.7, 216.5, 234.9, 262.6, 422.6 ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_88_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(y) qqline(y, col=2) if( save_plots ){ dev.off() } # Ex 4.89 (EPage 178): # DF = read.csv( "../../Data/CH04/ex04-89.txt", header=TRUE, quote="'" ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_89_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(DF$thickness) qqline(DF$thickness, col=2) if( save_plots ){ dev.off() } # Ex 4.90 (EPage 178): # DF = read.csv( "../../Data/CH04/ex04-90.txt", header=TRUE, quote="'" ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_90_plot.eps", onefile=FALSE, horizontal=FALSE) } plot( log(-log(1-DF$p)), log(DF$obsv) ) if( save_plots ){ dev.off() } # Ex 4.91 (EPage 178): # DF = read.csv( "../../Data/CH01/ex01-39.txt", header=TRUE, quote="'" ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_91_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(DF$P_Lives) qqline(DF$P_Lives, col=2) if( save_plots ){ dev.off() } # Ex 4.92 (EPage 178): # DF = read.csv( "../../Data/CH04/ex04-92.txt", header=TRUE, quote="'" ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_92_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(DF$loadlife) qqline(DF$loadlife, col=2) if( save_plots ){ dev.off() } n = dim(DF)[1] ii = 1:n ps = (ii-0.5)/n if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_92_weibull_plot.eps", onefile=FALSE, horizontal=FALSE) } plot( log(-log(1-ps)), log(DF$loadlife), main="QQ plot Weibull" ) if( save_plots ){ dev.off() } # Ex 4.93 (EPage 179): # DF = read.csv( "../../Data/CH01/ex01-83.txt", header=TRUE, quote="'" ) DF$LogX = log(DF$rainfall..acre.feet.) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_93_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(DF$LogX) qqline(DF$LogX, col=2) if( save_plots ){ dev.off() } # Ex 4.94 (EPage 179): # DF = read.csv( "../../Data/CH04/ex04-94.txt", header=TRUE, quote="'" ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_94_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(DF$precip) qqline(DF$precip, col=2) if( save_plots ){ dev.off() } if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_94_sqrt_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(sqrt(DF$precip)) qqline(sqrt(DF$precip), col=2) if( save_plots ){ dev.off() } if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_94_cube_root_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(DF$precip^(1/3)) qqline(DF$precip^(1/3), col=2) if( save_plots ){ dev.off() } # Ex 4.95 (EPage 179): # DF = read.csv( "../../Data/CH01/ex01-13.txt", header=TRUE, quote="'" ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_95_plot.eps", onefile=FALSE, horizontal=FALSE) } qqnorm(DF$strength) qqline(DF$strength, col=2) if( save_plots ){ dev.off() } # Ex 4.96 (EPage 179): # y = c( -3.78, -1.27, -1.44, -0.39, 12.38, -43.40, 1.15, -3.96, -2.34, 30.84 ) n = length(y) w = abs(y) ii = 1:n ps = ( ( ii - 0.5 ) / n + 1 ) / 2 xs = qnorm( ps ) ys = sort( w ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_96_plot.eps", onefile=FALSE, horizontal=FALSE) } plot( xs, ys ) grid() if( save_plots ){ dev.off() } # Ex 4.97 (EPage 179): # DF = read.csv( "../../Data/CH04/ex04-97.txt", header=TRUE, quote="'" ) n = length(DF$failtime) ii = 1:n ps = ( ii - 0.5 ) / n xs = qexp(ps) ys = sort( DF$failtime ) if( save_plots ){ postscript("../../WriteUp/Graphics/Chapter4/chap_4_ex_97_plot.eps", onefile=FALSE, horizontal=FALSE) } plot( xs, ys ) if( save_plots ){ dev.off() }