# # 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. # #----- sigma_n = 1 sigma_s = 2 # we assume that sigma_s > sigma_n p = 0.25 alpha = 0.75 l1_grid = seq( -10, +10, length.out=100 ) l2_grid = seq( -10, +10, length.out=100 ) A = sigma_n / sqrt( sigma_n^2 + sigma_s^2 ) # leading coefficient C = sigma_s^2 / ( 2 * sigma_n^2 * ( sigma_n^2 + sigma_s^2 ) ) # factor in the exponential Lambda_1 = A * exp( C * l1_grid ) Lambda_2 = A * exp( C * l2_grid ) #postscript("../../WriteUp/Graphics/Chapter2/prob_2.3.5.eps", onefile=FALSE, horizontal=FALSE) # First decision region : # Pt_1 = Lambda_1 - (1/p) + 2 Pt_2 = - ( alpha - 1 ) * Lambda_2 D1 = outer( Pt_1, Pt_2, FUN="+" ) contour( l1_grid, l2_grid, D1, levels=c(0), xlab="l_1", ylab="l_2", col="black" ) # Second decision region ( a duplicate of the first ): # Pt_1 = Lambda_2 - (1/p) + 2 Pt_2 = - ( alpha - 1 ) * Lambda_1 D2 = outer( Pt_1, Pt_2, FUN="+" ) contour( l1_grid, l2_grid, D2, levels=c(0), add=T, xlab="l_1", ylab="l_2", col="red" ) # Third decision region : # Pt_1 = Lambda_2 Pt_2 = - Lambda_1 D3 = outer( Pt_1, Pt_2, FUN="+" ) contour( l1_grid, l2_grid, D3, levels=c(0), add=T, xlab="l_1", ylab="l_2", col="green" ) text( 6, -2.5, "H_1" ) text( 0, -2.5, "H_0" ) text( -2.5, 0, "H_0" ) text( 0, 9, "H_2" ) #dev.off()