# # 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. # #----- alpha = 0.05 z_alpha = -qnorm( alpha ) sigma = 1 mu_0 = 1 n = 20 mu_prime = seq( 0, 3, length.out=100 ) beta_n_20 = pnorm( z_alpha + ( mu_0 - mu_prime ) / ( sigma / sqrt(n) ) ) n=100 beta_n_100 = pnorm( z_alpha + ( mu_0 - mu_prime ) / ( sigma / sqrt(n) ) ) #Plot both curves; # #postscript("../../WriteUp/Graphics/Chapter6/ex_1_beta_plots.eps", onefile=FALSE, horizontal=FALSE) plot( mu_prime, beta_n_20, type='l', col='black', xlab="mu'", ylab="beta", main="" ) lines( mu_prime, beta_n_100, type='l', col='green' ) legend( 2.0, 1.0, c('n=20','n=100'), lty=c(1,1), col=c('black', 'green') ) grid() #dev.off()